Skip to content

Commit

Permalink
fix: tag priorities for nuxt.config overrides
Browse files Browse the repository at this point in the history
Fixes #105
  • Loading branch information
harlan-zw committed Sep 12, 2023
1 parent 0f3095b commit 1cda345
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion .playground/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ definePageMeta({
useHead({
title: 'hello',
titleTemplate: '%s %separator %site.name'
})
</script>
<template>
Expand Down
7 changes: 5 additions & 2 deletions module/src/runtime/plugin/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,18 @@ export default defineNuxtPlugin({

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

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

useHead({
link: [{ rel: 'canonical', href: canonicalUrl }],
})

// TODO support SPA
useServerHead({
templateParams: { site: { name: siteConfig.name, url: siteConfig.url } },
Expand Down

0 comments on commit 1cda345

Please sign in to comment.