Support Log in
All Features: Translate WordPress with AI

Automatic Hreflang and XML Sitemap for Multilingual SEO


What is hreflang and why does it matter?

Hreflang is an HTML attribute (and an XML sitemap annotation) that tells Google which URL on your site is the correct version for a given language and region. Without hreflang, Google often guesses wrong — showing your French-speaking visitors the English version of your blog post, or indexing only one language out of five.

For any WordPress site targeting more than one country, hreflang is not optional. And because of how WordPress handles URLs, getting it right by hand is painful: you have to maintain a consistent set of reciprocal tags across every translated page, update them every time you add a language, and keep them in sync with your sitemap.

Lang Forge does all of that automatically, for every post, in both the HTML <head> and your XML sitemap.


What Lang Forge generates for you

Hreflang tags in the HTML head

For every post, page, or custom post type that has a translation, Lang Forge injects a complete set of <link rel="alternate" hreflang="..."> tags into the HTML head:

<link rel="alternate" hreflang="en" href="https://example.com/blog-post/" />
<link rel="alternate" hreflang="de" href="https://example.com/de/blog-post/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/blog-post/" />
<link rel="alternate" hreflang="es" href="https://example.com/es/blog-post/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/blog-post/" />

Reciprocal tagging is handled automatically — every translated version of the page knows about every other translation.

Custom multilingual XML sitemap

Lang Forge ships a dedicated sitemap at /sitemap-hreflang.xml that lists every post in every language, with full <xhtml:link> annotations per entry. Google Search Console accepts this format directly and uses it to understand your site’s multilingual structure.

Integration with the native WordPress sitemap

If you’re using WordPress 5.5+ with the built-in sitemap (/wp-sitemap.xml), Lang Forge injects hreflang data into it without a separate URL. Whichever sitemap you submit to Google, the translations are included.

Integration with your SEO plugin’s sitemap

If you’re already using Yoast SEO, Rank Math, AIOSEO, or SEOPress with their own sitemaps, Lang Forge hooks into those as well and ensures hreflang data is present in the sitemap your SEO plugin generates.


What happens when you add a language or translate a page

You don’t do anything. The next request to the page includes the new hreflang tags. The next sitemap regeneration includes the new entry. Google finds it on its next crawl.

There’s no “regenerate sitemap” button. No “update hreflang” action. It’s wired into the normal WordPress publish and update lifecycle.


How to verify hreflang is working

After you activate Lang Forge and translate your first post:

  1. Open the translated post in a browser
  2. View source
  3. Search for hreflang — you should see a complete set of tags for every language version
  4. Open /sitemap-hreflang.xml directly and confirm every translated post appears
  5. Submit the sitemap in Google Search Console → Sitemaps

Search Console’s International Targeting report will start showing hreflang data within a few days of indexing.


Fallback for query-based URL structures

If you’ve chosen the parameter URL format (?lang=de), hreflang tags still work correctly. Lang Forge generates absolute URLs with the correct query parameter and Google treats each parameterized URL as a distinct page.


Related reading


Ready to fix your multilingual SEO?

Get Lang Forge — from $54/year →

Automatic hreflang tags and multilingual XML sitemaps are included in every paid plan — and in the free version on WordPress.org.

Forge AI Assistant Online

Hi! I'm the Lang Forge AI assistant. Ask me anything about the plugin — setup, features, troubleshooting, or development.

Just now
Powered by Forge AI · Browse docs