Skip to content

Commit

Permalink
fix: use lower priority for nuxtseo defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Sep 9, 2023
1 parent 47b2fc5 commit 6fcf891
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions module/src/runtime/plugin/defaults.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import type { SiteConfig } from 'nuxt-site-config-kit'
import { defineNuxtPlugin } from 'nuxt/app'
import type { UseHeadOptions, UseSeoMetaInput } from '@unhead/vue'
import type { Organization, Person } from '@unhead/schema-org'
import {
computed,
createSitePathResolver,
defineOgImage,
defineOrganization,
definePerson,
defineRobotMeta,
defineWebPage,
defineWebSite,
Expand Down Expand Up @@ -41,20 +45,26 @@ export default defineNuxtPlugin({
return lastSegment ? titleCase(lastSegment) : null
})

const minimalPriority: UseHeadOptions = {
// give nuxt.config values higher priority
tagPriority: 15,
}

useHead({
// fallback title
title,
link: [{ rel: 'canonical', href: canonicalUrl }],
})
}, minimalPriority)

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

useSeoMeta({
const seoMeta: UseSeoMetaInput = {
ogUrl: canonicalUrl,
// TODO integrate with nuxt/i18n
ogLocale: siteConfig.defaultLocale,
Expand Down

0 comments on commit 6fcf891

Please sign in to comment.