Skip to content

Commit e7bda9b

Browse files
committed
chore(seo): standardize meta
1 parent 3fed71f commit e7bda9b

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

app/pages/[...slug].vue

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ definePageMeta({
77
})
88
99
const route = useRoute()
10-
const { toc, seo } = useAppConfig()
10+
const { toc } = useAppConfig()
1111
const navigation = inject<Ref<ContentNavigationItem[]>>('navigation')
1212
1313
const { data: page } = await useAsyncData(route.path, () => queryCollection('docs').path(route.path).first())
@@ -21,11 +21,14 @@ const { data: surround } = await useAsyncData(`${route.path}-surround`, () => {
2121
})
2222
})
2323
24+
const title = page.value.seo?.title || page.value.title
25+
const description = page.value.seo?.description || page.value.description
26+
2427
useSeoMeta({
25-
title: page.value.seo.title,
26-
ogTitle: `${page.value.seo.title} - ${seo?.siteName}`,
27-
description: page.value.seo.description,
28-
ogDescription: page.value.seo.description
28+
title,
29+
ogTitle: title,
30+
description,
31+
ogDescription: description
2932
})
3033
3134
const headline = computed(() => findPageHeadline(navigation?.value, page.value))

app/pages/index.vue

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ if (!page.value) {
44
throw createError({ statusCode: 404, statusMessage: 'Page not found', fatal: true })
55
}
66
7+
const title = page.value.seo?.title || page.value.title
8+
const description = page.value.seo?.description || page.value.description
9+
710
useSeoMeta({
8-
title: page.value.seo.title,
9-
titleTemplate: null,
10-
ogTitle: page.value.seo.title,
11-
description: page.value.seo.description,
12-
ogDescription: page.value.seo.description,
11+
title,
12+
ogTitle: title,
13+
description,
14+
ogDescription: description,
1315
ogImage: 'https://docs-template.nuxt.dev/social-card.png',
1416
twitterImage: 'https://docs-template.nuxt.dev/social-card.png'
1517
})

0 commit comments

Comments
 (0)