16 lines
733 B
TypeScript
16 lines
733 B
TypeScript
// One head entry for the whole app, following the resolve answer of the
|
|
// current page. tagPriority 'critical' makes its tags win over the same
|
|
// tags a page or another module sets (unhead keeps the lower weight), so
|
|
// editor values from the SEO plugin override the content defaults; a value
|
|
// the answer lacks leaves the page's own tag in place.
|
|
|
|
import { seoHeadInput } from '../utils/seo.ts'
|
|
|
|
export default defineNuxtPlugin(() => {
|
|
const config = useRuntimeConfig()
|
|
if ((config.public.seo as { enabled?: boolean } | undefined)?.enabled === false) return
|
|
const answer = useSeoAnswer()
|
|
const origin = useRequestURL().origin
|
|
useHead(computed(() => seoHeadInput(answer.value, origin)), { tagPriority: 'critical' })
|
|
})
|