feat: vue-seo-layer, the Nuxt half of the SummerCMS SEO plugin
This commit is contained in:
14
app/plugins/seo-head.ts
Normal file
14
app/plugins/seo-head.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
// 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()
|
||||
useHead(computed(() => seoHeadInput(answer.value)), { tagPriority: 'critical' })
|
||||
})
|
||||
Reference in New Issue
Block a user