
hreflang Generator Tutorial: Correct Tags in One Click
An hreflang generator automates the rules people get wrong by hand — every page must list all languages, include a self-reference and an x-default, and stay bidirectionally consistent. You enter the URL for each language version, pick the default, and the tool spits out a complete tag set you can paste straight in. GeoSeoToday’s hreflang generator is free, no sign-up, and this guide walks through the full workflow.
Why use a generator? The three ways hand-coding kills you
The hreflang rules aren’t hard to understand, but they’re brutally easy to get wrong by hand — and a mistake doesn’t throw an error, it just silently stops working:
- Missing return links. One annotation set on a trilingual site means 4 lines on each of 3 pages — 12 identical lines that all have to agree. Edit one page and forget the other two, and the whole set is void.
- Missing self-reference. Intuition says “you don’t need to tag yourself,” but the hreflang spec requires every page to list itself in the set. Omit it and the annotation fails.
- Wrong language codes.
zh-twversuszh-Hant,en-UK(wrong) versusen-GB(right) — every hand-typed tag is another chance to slip.
These errors are the number-one cause of Traditional/Simplified Chinese cannibalizing each other. The value of a generator isn’t saving keystrokes — it’s baking the rules into the tool so the mistakes can’t happen.
Three-step tutorial
Step 1: Enter the URL for each language version
In the hreflang generator, add one row per language version of the same piece of content — a language code plus the full URL (it must be an absolute path including https://):
| Language code | Example URL |
|---|---|
| zh-Hant | https://example.com/zh-hant/geo-guide/ |
| zh-Hans | https://example.com/zh-hans/geo-guide/ |
| en | https://example.com/en/geo-guide/ |
How to pick the language code: use zh-Hant to serve Traditional Chinese readers worldwide; only split into zh-TW and zh-HK when you’ve actually prepared different content for Taiwan and Hong Kong.
Step 2: Choose where x-default points
Pick one of the versions you entered as the default exit. The decision is simple: if there’s an English version, point to it; on a Chinese-only site, point to your primary-market version.
Step 3: Copy the generated tags
The tool gives you two formats at once — use one, not both (don’t put it in both places):
HTML format (paste into the <head> of each language version — the same set on all three pages):
<link rel="alternate" hreflang="zh-Hant" href="https://example.com/zh-hant/geo-guide/" />
<link rel="alternate" hreflang="zh-Hans" href="https://example.com/zh-hans/geo-guide/" />
<link rel="alternate" hreflang="en" href="https://example.com/en/geo-guide/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/en/geo-guide/" />
Sitemap format (paste into the matching <url> block of your XML sitemap — better for large sites that want to maintain everything in one place).
After you paste it: 3 checks
- Spot-check the source. Every language version’s page should show all four lines (including itself).
- Crawl it. Run a site-wide hreflang report with a tool like Screaming Frog to confirm there are no missing return links.
- Watch the split in GSC. After 2–6 weeks, cross-tabulate country × directory in the Performance report; the Simplified version’s share of impressions in Taiwan should drop noticeably.
When a generator can’t save you
The tags the tool produces are correct, but you have to handle these yourself first:
- The URL itself is broken. Pointing at a redirecting, 404, or noindex page makes even a perfect tag useless.
- Canonical conflicts. Each language version’s canonical must point to itself; pointing it at another language version cancels out the hreflang.
- The content isn’t actually localized. hreflang solves “who to serve it to,” not “is it worth reading.” A machine-translated page still won’t earn clicks even if the routing is correct.
Frequently asked questions (FAQ)
Q1: Is the generator free? Do I need to register? GeoSeoToday’s hreflang generator is completely free with no sign-up. We built it as a web tool because our own trilingual site runs on the same logic every single day.
Q2: My site has hundreds of pages — do I run the generator on every one by hand? No. The generator is for “locking in the correct format” and handling key pages. At scale, the real answer is to bake the output format into your CMS or framework template (like an Astro/Next.js layout) so the whole site emits tags automatically per route.
Q3: Should the tags go in HTML or the sitemap? Few pages and a controllable template → HTML head. Many pages and a system-generated sitemap → the sitemap. The point is to pick one; having both in place and out of sync is a common failure.
Q4: Can Traditional/Simplified cannibalization still happen after using the generator? Tag-level errors get eliminated, but cannibalization has other causes: a misconfigured canonical, or Simplified content that’s too close to the Traditional. Pair it with a hreflang-mistakes troubleshooting checklist to hunt those down.
Drop your multilingual pages into GeoSeoToday’s hreflang generator and GEO checker and get correct tags in 30 seconds. To understand the reasoning behind the tags, start with a primer on what hreflang is; for the full picture of a multilingual setup, see the pillar guide to multilingual and international SEO.