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

fix(nuxt): remove duplicate titleTemplate #6295

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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