Skip to content

Commit

Permalink
feat: nuxt-themes#157 handle canonical property in articles (#194)
Browse files Browse the repository at this point in the history
deepinder10 authored May 2, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent c01be48 commit ff4602b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions layouts/article.vue
Original file line number Diff line number Diff line change
@@ -47,11 +47,19 @@ const alpine = useAppConfig().alpine
const article = ref<HTMLElement | null>(null)
if (page.value && page.value.cover) {
if (page.value) {
const linkArray = []
const metaArray = []
if (page.value.cover) {
metaArray.push({ property: 'og:image', content: page.value.cover })
}
if (page.value.canonical) {
linkArray.push({ rel: 'canonical', href: page.value.canonical })
}
useHead({
meta: [
{ property: 'og:image', content: page.value.cover }
]
meta: metaArray,
link: linkArray
})
}

0 comments on commit ff4602b

Please sign in to comment.