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 adds the tags to the HTML <head> of each translated page and the annotations to its own 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 its own sitemap at /sitemap-hreflang.xml. It is an index that points to /sitemap-hreflang-1.xml, /sitemap-hreflang-2.xml and so on, with up to 1,000 posts in each file. Each entry is a default-language post that has a translation, with an <xhtml:link> annotation for each published language version and an x-default annotation for the default language version. Posts without a translation are not listed. You can submit the file in Google Search Console under Sitemaps.

The WordPress sitemap and your SEO plugin

Lang Forge does not change the built-in WordPress sitemap (/wp-sitemap.xml). If you use Yoast SEO, Lang Forge adds the language versions to the entries of the Yoast SEO sitemap through Yoast’s sitemap entry filter. For any other sitemap, use /sitemap-hreflang.xml.


What happens when you add a language or translate a page

You do not have to do anything. The hreflang tags are printed when a page is requested, and /sitemap-hreflang.xml is built when it is requested, so a new translation is listed the next time the file is opened. Only published translations are listed; drafts are left out. There is no “regenerate sitemap” button.


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

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?

See pricing →

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