hreflang Generator Guide
Translating pages is not enough. You also need search engines to show the right language URL to the right users. hreflang is the standard way to do it.
1) Map languages to URLs
For the same content, prepare a set of URLs across languages/regions. Example:
text
zh-TW: https://example.com/docs/seo
en: https://example.com/en/docs/seo
x-default: https://example.com/en/docs/seo2) Generate tags with the tool
Open the hreflang generator, fill the hreflang codes and URLs, then copy the output as HTML tags or sitemap xhtml:link.
html
<link rel="alternate" hreflang="zh-TW" href="https://example.com/docs/seo" />
<link rel="alternate" hreflang="en" href="https://example.com/en/docs/seo" />
<link rel="alternate" hreflang="x-default" href="https://example.com/en/docs/seo" />3) Where to place hreflang
- Add to each page’s
<head>(works with SSR/SSG/prerender) - Add to sitemap.xml via
xhtml:link(great for scale)
xml
<url>
<loc>https://example.com/docs/seo</loc>
<xhtml:link rel="alternate" hreflang="zh-TW" href="https://example.com/docs/seo" />
<xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/docs/seo" />
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/en/docs/seo" />
</url>Related: International SEO, hreflang, x-default
4) Common mistakes
- Missing self hreflang on each page
- Not reciprocal (A points to B, but B doesn’t point back)
- Canonicalizing different languages to one URL (should be self-canonical)
- Wrong codes (case/region mismatches)
FAQ
Common hreflang questions.