Skip to content

Commit

Permalink
fix: add description in useContentHead and avoid slash duplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-mulier-p committed Feb 17, 2025
1 parent d6925f5 commit 9282224
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions composables/useContentHead.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,27 @@ export default function useContentHead(page: Ref<undefined | {title?:string, des
const title = computed(() => page.value?.title)
const description = computed(() => page.value?.description)
const image = computed(() => page.value?.image)
const path = computed(() => page.value?.path)
const path = computed(() => {
let result = page.value?.path;
if (result?.startsWith("/")) {
return result.substring(1);
}

return result;
})

const {origin} = useRequestURL()

useHead({
title: title.value,
meta: [
{property: 'og:title', content: title.value},
{property: 'og:description', content: description.value},
{property: 'og:image', content: image},
{property: 'og:image:type', content: "image/svg+xml"},
{property: 'og:image:alt', content: title.value},
{property: 'og:url', content: `${origin}/${path.value}`},
{name: 'description', content: description.value},
{name: 'og:title', content: title.value},
{name: 'og:description', content: description.value},
{name: 'og:image', content: image},
{name: 'og:image:type', content: "image/svg+xml"},
{name: 'og:image:alt', content: title.value},
{name: 'og:url', content: `${origin}/${path.value}`},
{name: 'twitter:card', content: 'summary_large_image'},
{name: 'twitter:site', content: '@kestra_io'},
{name: 'twitter:title', content: title.value},
Expand Down

0 comments on commit 9282224

Please sign in to comment.