Skip to content

Commit

Permalink
fix: prefer useServerHead for static head data
Browse files Browse the repository at this point in the history
Fixes #87
  • Loading branch information
harlan-zw committed Aug 30, 2023
1 parent b4ace93 commit ba51818
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions module/src/runtime/plugin/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
useRoute,
useSchemaOrg,
useSeoMeta,
useServerHead,
useSiteConfig,
} from '#imports'

Expand Down Expand Up @@ -42,14 +43,17 @@ export default defineNuxtPlugin({
})

useHead({
templateParams: { site: () => siteConfig, separator: siteConfig.titleSeparator },
// TODO fetch locale using i18n
htmlAttrs: { lang: () => siteConfig.locale },
titleTemplate: '%s %separator %site.name',
title,
link: [{ rel: 'canonical', href: canonicalUrl }],
})

useServerHead({
templateParams: { site: () => siteConfig, separator: siteConfig.titleSeparator },
// TODO integrate with nuxt/i18n
htmlAttrs: { lang: () => siteConfig.deaultLocale },
titleTemplate: '%s %separator %site.name',
})

useSeoMeta({
ogUrl: canonicalUrl,
// TODO integrate with nuxt/i18n
Expand All @@ -65,7 +69,8 @@ export default defineNuxtPlugin({
useSchemaOrg([
defineWebSite({
name: () => siteConfig?.name || '',
inLanguage: () => siteConfig?.locale || '',
// TODO integrate with nuxt/i18n
inLanguage: () => siteConfig?.defaultLocale || '',
description: () => siteConfig?.description || '',
}),
defineWebPage(),
Expand Down

0 comments on commit ba51818

Please sign in to comment.