Strapi hreflang
Strapi's i18n feature stores locales, but docs do not mention hreflang. Set up locales, fetch each one, and emit hreflang from your frontend.
Strapi's Internationalization feature manages locales and localized content, but its docs do not mention hreflang, so your frontend has to emit the tags. Add locales under Settings > Global Settings > Internationalization, enable localization on the content type, then output one alternate link per published locale, including a self-reference.
Where does your site stand?
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
- Free audit in 60 seconds
- Fixes drafted for your review
- ChatGPT, Perplexity, Gemini and AI Overviews tracked
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
- Re-check after big site changes
- Keep this page for reference
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
- Follow the steps below
- Top-traffic pages first
- Check again in a month
4 parts, 3 minutes.
What Strapi gives you, and what it does not
| Need | Strapi | Source |
|---|---|---|
| Add locales | Yes - Settings > Global Settings > Internationalization | Internationalization docs |
| Custom locale codes | No - "It is not possible to create custom locales." | Internationalization docs |
| Localize a content type or field | Yes - tick Internationalization in the Content-type Builder's Advanced settings, then "Enable localization for this field" | Internationalization docs |
| Publish one language at a time | Yes - publishing applies only to the locale you are working in | Internationalization docs |
| Fetch one locale over REST | Yes - the locale parameter | REST locale docs |
| Output hreflang tags | Not documented - the i18n page does not mention hreflang | Your frontend |
By default only the English locale is configured, and only one locale can be the default for the whole application. An omitted locale parameter returns the default locale.
Set up locales and fetch each one
curl 'http://localhost:1337/api/restaurants?locale=fr' \
-H 'Authorization: Bearer <token>'- 01
Add locales
Go to Settings > Global Settings > Internationalization and add the locales from Strapi's pre-created list. Pick the default carefully, since only one can be the default.
- 02
Enable localization on the content type and fields
In the Content-type Builder's Advanced settings tab, tick Internationalization on the content type, and Enable localization for this field on each field that varies by language.
- 03
Create and publish each translation
In the Content Manager, use the locale drop-down at the top right of the edit view to switch language. Fill in from another locale copies values across. Publish each locale separately.
- 04
Request a locale
Pass the
localeparameter on the REST API, as in the example below.
Emit hreflang from the frontend
- 01Build the list from the locales you have actually published for that entry, so you never link to a locale that returns a 404.
- 02Use only ISO 639-1 language codes and ISO 3166-1 Alpha 2 region codes. Google says codes such as es-419 are not supported.
- 03Google says the reserved
x-defaultvalue is used when no other language or region matches the visitor. - 04Make sure the locale codes you configured in Strapi map cleanly to those hreflang values, since Strapi's pre-created list is the only source of locale codes.
<link rel="alternate" hreflang="en" href="https://example.com/en/pricing" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/tarifs" />
<link rel="alternate" hreflang="x-default" href="https://example.com/en/pricing" />Check it worked
- 1
Read the rendered head
View source on one page in each locale and confirm it lists itself plus every sibling.
- 2
Follow every alternate
Open each alternate URL and confirm it returns 200 with that locale's content and links back to the others.
- 3
Compare with the API
Request each locale with
?locale=and confirm each is published, since the Content Manager publishes per locale.
More on the markup in the hreflang glossary entry, and on the title and description side in Strapi title and meta.
Related Strapi guide: Strapi title tags and meta descriptions.
Asked a lot.
2 questions people ask next, answered from the sources on this page.
01Does Strapi add hreflang tags?
Strapi's Internationalization docs do not mention hreflang. Your frontend has to output the tags using the locales Strapi stores.
02Can I create a custom locale in Strapi?
No. Strapi's docs say it is not possible to create custom locales; you choose from its pre-created list.
Every fact, linked and dated.
strapi.io
google.com
- 01Internationalization (i18n) | Strapi Docsdocs.strapi.io · checked 2026-11-01
- 02REST API: locale | Strapi Docsdocs.strapi.io · checked 2026-11-01
- 03Localized versions of your pages | Google Search Centraldevelopers.google.com · checked 2026-11-01
Tools point. Agencies advise. This one ships.
Run the free audit, then approve the fixes. Every change can be undone.
- 46 fixes shipped without a ticket Brightpipe
- 0→7 ChatGPT citations in six weeks Paylane