Nuxt SEO Utils automatically sets the <html lang="..."> attribute and locale-based meta tags for your site.
Nuxt SEO Utils will automatically set:
<html lang="..."> - Current locale based on your configurationog:locale - OpenGraph locale (e.g., en_US, ja_JP)inLanguage - For WebSite, WebPage, and other structured data (when using Nuxt Schema.org)useBreadcrumbItems() - Automatically handles locale-prefixed routes and translates labels via i18n keys (breadcrumb.items.{routeName}.label)og:locale requires a locale format with underscore (e.g., en_US). If your locale is just "en", the module won't set og:locale automatically.When automaticDefaults is enabled (default), the module sets the lang attribute using this priority:
@nuxtjs/i18n or nuxt-i18n-micro module - Automatically detected and integratedcurrentLocale - Dynamic locale from useSiteConfig()defaultLocale - Static default from nuxt.config.ts"en"The locale is set with low priority, allowing you to override it manually if needed.
If you're building a multilingual site, install @nuxtjs/i18n.
For single language sites without @nuxtjs/i18n, set the locale via Site Config:
export default defineNuxtConfig({
site: {
defaultLocale: 'ja-JP'
}
})
en, use en-US, en-AU, or whatever is appropriate for your site. The module automatically converts this to underscore format (en_US) for og:locale.If you need to change the locale dynamically without using the I18n module, use updateSiteConfig():
<script setup>
updateSiteConfig({
currentLocale: 'ja-JP'
})
</script>
To manually control all locale settings, disable automatic defaults:
export default defineNuxtConfig({
seo: {
automaticDefaults: false
}
})
Then set everything manually:
useHead({
htmlAttrs: { lang: 'ja-JP' }
})
useSeoMeta({
ogLocale: 'ja_JP'
})