Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions site/app/composables/usePageSeo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ const DEFAULT_DESCRIPTION =
'AutoFixture makes unit tests more productive by creating anonymous test data for .NET.'

const DEFAULT_OG_IMAGE = '/og-image.png'
const OG_IMAGE_WIDTH = '1200'
const OG_IMAGE_HEIGHT = '630'

/** Crawlers such as Telegram and Teams often read only the first ~16 KB of HTML. */
const seoTagPriority = -5

type PageSeoOptions = {
title?: MaybeRefOrGetter<string | undefined>
Expand All @@ -21,17 +26,19 @@ export function usePageSeo(options: PageSeoOptions = {}) {
useHead({
title,
meta: computed(() => [
{ name: 'description', content: description.value },
{ property: 'og:title', content: title.value },
{ property: 'og:description', content: description.value },
{ property: 'og:image', content: image.value },
{ property: 'og:url', content: url.value },
{ property: 'og:type', content: 'website' },
{ property: 'og:site_name', content: 'AutoFixture' },
{ name: 'twitter:card', content: 'summary_large_image' },
{ name: 'twitter:title', content: title.value },
{ name: 'twitter:description', content: description.value },
{ name: 'twitter:image', content: image.value },
{ name: 'description', content: description.value, tagPriority: seoTagPriority },
{ property: 'og:site_name', content: 'AutoFixture', tagPriority: seoTagPriority },
{ property: 'og:type', content: 'website', tagPriority: seoTagPriority },
{ property: 'og:title', content: title.value, tagPriority: seoTagPriority },
{ property: 'og:description', content: description.value, tagPriority: seoTagPriority },
{ property: 'og:image', content: image.value, tagPriority: seoTagPriority },
{ property: 'og:image:width', content: OG_IMAGE_WIDTH, tagPriority: seoTagPriority },
{ property: 'og:image:height', content: OG_IMAGE_HEIGHT, tagPriority: seoTagPriority },
{ property: 'og:url', content: url.value, tagPriority: seoTagPriority },
{ name: 'twitter:card', content: 'summary_large_image', tagPriority: seoTagPriority },
{ name: 'twitter:title', content: title.value, tagPriority: seoTagPriority },
{ name: 'twitter:description', content: description.value, tagPriority: seoTagPriority },
{ name: 'twitter:image', content: image.value, tagPriority: seoTagPriority },
]),
})
}
25 changes: 14 additions & 11 deletions site/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const siteUrl = 'https://autofixture.com'
const siteDescription =
'AutoFixture makes unit tests more productive by creating anonymous test data for .NET.'
const ogImage = `${siteUrl}/og-image.png`
const seoTagPriority = -5

export default defineNuxtConfig({
runtimeConfig: {
Expand All @@ -47,17 +48,19 @@ export default defineNuxtConfig({
head: {
title: 'AutoFixture',
meta: [
{ name: 'description', content: siteDescription },
{ property: 'og:site_name', content: 'AutoFixture' },
{ property: 'og:type', content: 'website' },
{ property: 'og:title', content: 'AutoFixture' },
{ property: 'og:description', content: siteDescription },
{ property: 'og:image', content: ogImage },
{ property: 'og:url', content: `${siteUrl}/` },
{ name: 'twitter:card', content: 'summary_large_image' },
{ name: 'twitter:title', content: 'AutoFixture' },
{ name: 'twitter:description', content: siteDescription },
{ name: 'twitter:image', content: ogImage },
{ name: 'description', content: siteDescription, tagPriority: seoTagPriority },
{ property: 'og:site_name', content: 'AutoFixture', tagPriority: seoTagPriority },
{ property: 'og:type', content: 'website', tagPriority: seoTagPriority },
{ property: 'og:title', content: 'AutoFixture', tagPriority: seoTagPriority },
{ property: 'og:description', content: siteDescription, tagPriority: seoTagPriority },
{ property: 'og:image', content: ogImage, tagPriority: seoTagPriority },
{ property: 'og:image:width', content: '1200', tagPriority: seoTagPriority },
{ property: 'og:image:height', content: '630', tagPriority: seoTagPriority },
{ property: 'og:url', content: `${siteUrl}/`, tagPriority: seoTagPriority },
{ name: 'twitter:card', content: 'summary_large_image', tagPriority: seoTagPriority },
{ name: 'twitter:title', content: 'AutoFixture', tagPriority: seoTagPriority },
{ name: 'twitter:description', content: siteDescription, tagPriority: seoTagPriority },
{ name: 'twitter:image', content: ogImage, tagPriority: seoTagPriority },
],
link: [
{ rel: 'icon', type: 'image/svg+xml', href: '/favicon.svg' },
Expand Down