---
title: "useLocaleSeo"
description: "Inject hreflang alternate links, x-default and og:locale on multilingual sites so search engines can tell the language versions apart. The layer's app.vue already calls it globally; call it yourself only when you rewrite app.vue."
canonical_url: "https://docs.mhaibaraai.cn/en/docs/reference/composables/use-locale-seo"
---
# useLocaleSeo

> Inject hreflang alternate links, x-default and og:locale on multilingual sites so search engines can tell the language versions apart. The layer's app.vue already calls it globally; call it yourself only when you rewrite app.vue.

`useLocaleSeo()` only takes effect when `@nuxtjs/i18n` is enabled with at least two valid locales; otherwise it returns without injecting anything.

## Usage

```vue [app/app.vue]
<script setup lang="ts">
await useDocsShell()
useLocaleSeo()
</script>
```

## Signature

```ts
function useLocaleSeo(): void
```

## Injected Tags

| Tag | Value |
| --- | --- |
| `<link rel="alternate" hreflang="{code}">` | One per valid locale; `href` is `site.url` plus the current page's path in that locale |
| `<link rel="alternate" hreflang="x-default">` | Points to the current page in the first locale of the list |
| `<meta property="og:locale">` | Current locale code with `-` replaced by `_`, such as `zh_CN` |

## Notes

- Links are absolute, so `site.url` must be set in `nuxt.config`.
- No alternate is generated for a locale where the page does not exist (`switchLocalePath` returns an empty string).

## Related

- [Internationalization](https://docs.mhaibaraai.cn/en/docs/guide/i18n)
- [useMovkI18n](https://docs.mhaibaraai.cn/en/docs/reference/composables/use-movk-i18n)

## Changelog

See commit history for [layer/app/composables/useLocaleSeo.ts](https://github.com/mhaibaraai/movk-nuxt-docs/commits/main/layer/app/composables/useLocaleSeo.ts).

---

- [GitHub](https://github.com/mhaibaraai/movk-nuxt-docs/blob/main/layer/app/composables/useLocaleSeo.ts)


## Sitemap

See the full [sitemap](https://docs.mhaibaraai.cn/sitemap.md) for all pages.
