Skip to content

Commit

Permalink
feat: #157 handle canonical property in articles (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepinder10 authored May 2, 2024
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
Expand Up @@ -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
})
}
Expand Down

0 comments on commit ff4602b

Please sign in to comment.