useLocaleHead
The useLocaleHead() composable returns localized head properties for locale-related aspects.
The useLocaleHead() composable returns localized head properties for locale-related aspects.
Type
declare function useLocaleHead(options: I18nHeadOptions): Ref<I18nHeadMetaInfo>
Parameters
options
An object accepting the following optional fields:
dir- type:
boolean - default:
true - Adds a
dirattribute to the HTML element.
- type:
lang- type:
boolean - default:
true - Adds a
langattribute to the HTML element.
- type:
seo- type:
boolean | SeoAttributesOptions - Adds various SEO attributes.
- type:
Usage
<script setup>
const i18nHead = useLocaleHead({
seo: {
canonicalQueries: ['foo']
}
})
useHead(() => ({
htmlAttrs: {
lang: i18nHead.value.htmlAttrs!.lang
},
link: [...(i18nHead.value.link || [])],
meta: [...(i18nHead.value.meta || [])]
}))
</script>