The useLocaleHead()
composable returns localized head properties for locale-related aspects.
declare function useLocaleHead(options: I18nHeadOptions): Ref<I18nHeadMetaInfo>
options
An object accepting the following optional fields:
dir
boolean
true
dir
attribute to the HTML element.lang
boolean
true
lang
attribute to the HTML element.seo
boolean | SeoAttributesOptions
key
string
'hid'
<meta>
tag.<script setup>
const i18nHead = useLocaleHead({
seo: {
canonicalQueries: ['foo']
}
})
useHead({
htmlAttrs: {
lang: i18nHead.value.htmlAttrs!.lang
},
link: [...(i18nHead.value.link || [])],
meta: [...(i18nHead.value.meta || [])]
})
</script>