Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
fix(nuxt): remove duplicate titleTemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Aug 2, 2022
1 parent c72093b commit 6a9f0f8
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions packages/nuxt/src/head/runtime/lib/vueuse-head.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,11 @@ export default defineNuxtPlugin((nuxtApp) => {
headReady = true
})

const titleTemplate = ref<MetaObject['titleTemplate']>()

nuxtApp._useHead = (_meta: MetaObject | ComputedGetter<MetaObject>) => {
const meta = ref<MetaObject>(_meta)
if ('titleTemplate' in meta.value) {
titleTemplate.value = meta.value.titleTemplate
}

const headObj = computed(() => {
const overrides: MetaObject = { meta: [] }
if (titleTemplate.value && 'title' in meta.value) {
overrides.title = typeof titleTemplate.value === 'function' ? titleTemplate.value(meta.value.title) : titleTemplate.value.replace(/%s/g, meta.value.title)
}
if (meta.value.charset) {
overrides.meta!.push({ key: 'charset', charset: meta.value.charset })
}
Expand Down

0 comments on commit 6a9f0f8

Please sign in to comment.