diff --git a/playground/nuxt.config.ts b/playground/nuxt.config.ts index 6dcb3c4..b5a8c45 100644 --- a/playground/nuxt.config.ts +++ b/playground/nuxt.config.ts @@ -14,6 +14,7 @@ export default defineNuxtConfig({ name: 'SEO Experiments', tagline: 'test', debug: true, + titleSeparator: 'l', }, app: { @@ -21,6 +22,9 @@ export default defineNuxtConfig({ description: 'Hi, welcome to the %envName v%app.version of %siteName.', }, head: { + templateParams: { + separator: 'x', + }, title: '%site.tagline', // DEV - My page title - My cool site titleTemplate: '%s %separator %site.name', @@ -32,7 +36,6 @@ export default defineNuxtConfig({ app: { version: '1.3.4', }, - titleSeparator: '|', envName: process.env.NODE_ENV === 'development' ? 'dev' : 'live', }, }, diff --git a/src/runtime/plugins/siteConfig.ts b/src/runtime/plugins/siteConfig.ts index 3426421..c5e6bf2 100644 --- a/src/runtime/plugins/siteConfig.ts +++ b/src/runtime/plugins/siteConfig.ts @@ -11,18 +11,19 @@ export default defineNuxtPlugin(() => { const siteConfig = { ...useSiteConfig() } as Record delete siteConfig._context - const separator = siteConfig.separator || siteConfig.titleSeparator const input: Head = { meta: [], templateParams: { site: siteConfig, - separator, - titleSeparator: separator, // support legacy siteUrl: siteConfig.url, siteName: siteConfig.name, }, } + if (siteConfig.separator) + input.templateParams!.separator = siteConfig.separator + if (siteConfig.titleSeparator) + input.templateParams!.titleSeparator = siteConfig.titleSeparator if (siteConfig.description) { input.templateParams!.siteDescription = siteConfig.description // we can setup a meta description @@ -33,5 +34,5 @@ export default defineNuxtPlugin(() => { }, ) } - head.push(input) + head.push(input, { tagPriority: 150 }) })