To get started when you need to generate hreflang, define one complete cluster of equivalent localized pages, convert it into locale-and-absolute-URL rows, and carry the same generated set through publishing and live verification.
Hreflang describes relationships between substantially equivalent pages in different languages or regions. It does not translate content, detect a page’s language, or guarantee a search result. Your first task is therefore to identify the pages that genuinely belong together before generating any tags.
A practical first project is one bounded language cluster: the page currently being edited plus all of its legitimate alternates. Keep that inventory in your CMS or publishing workflow as the source of truth, then use it to generate, install, and test one consistent set.

Choose the pages that belong together
Begin by separating equivalent content from pages that merely share a domain, template, or market. A URL should join the cluster when it offers the same underlying page for a different language or region. A campaign landing page, help article, or location page with a different purpose should not be included simply to increase the locale count.
- Include the page you are currently editing as a self-reference.
- Include every published alternate that represents the same content.
- Add an x-default row only when a real fallback page already exists.
- Record the final absolute URL for each row so redirects and moved pages do not leave stale declarations behind.
| Site situation | What belongs in the cluster | Example locale pattern |
|---|---|---|
| Separate language editions | One row for each equivalent translated page | en, fr, ja |
| Country-specific editions | Each regional page that is a distinct equivalent version | en-US, en-GB |
| Generic and regional French pages | A generic page only when it has a distinct, useful role | fr plus fr-CA |
| Unmatched-user fallback | One genuine selector or generic fallback page | x-default |
This inventory is a relationship map, not a list of every country your business serves. If two proposed pages do not contain substantially equivalent content, grouping them can make the hreflang setup misleading.
Build the generator input
The Hreflang Generator accepts one locale and one fully qualified URL per line, separated by one literal vertical bar. For example: en | https://www.example.com/en/. Keep the input to exactly two fields per line and one separator; extra columns or additional separators cause the row to be malformed.
- Use absolute HTTP or HTTPS URLs that include the host. Relative and scheme-relative references are rejected.
- Do not include credentials or fragments in a URL. Both are rejected.
- Supply at least two rows, including the current page, and no more than 100 rows.
- Do not repeat a locale in the same set. Duplicates are rejected case-insensitively after normalization.
- Use only one x-default row because the token identifies one fallback target rather than a language.
Locale casing is canonicalized, so en-us becomes en-US, zh-hant becomes zh-Hant, and fr-ca becomes fr-CA. A locale begins with a two-letter language code and may include a four-letter script and two-letter region. A country code cannot stand alone as the first subtag.
The generator checks the shape of the locale, but it does not prove that every intended language or region is currently supported for your search strategy or appropriate for the page’s audience. Confirm those decisions against Google Search Central’s localized versions guidance before deployment.
Run the first generation
- Freeze the cluster inventory. List every equivalent localized URL, including the page currently being edited. Mark the optional x-default row separately so its purpose is clear.
- Convert the inventory into rows. Write one locale and absolute URL on each line, using exactly one literal vertical bar between them. Confirm that the URLs are the final pages you intend to reference.
- Review each locale. Check the language, optional script, and optional region against the intended audience. Treat canonical casing as formatting, not as proof that a locale is suitable for the content.
- Paste the rows into the Hreflang Generator. If a row is malformed, the entire set is rejected rather than producing partial output that could silently omit a locale.
- Generate the complete block. The tool returns one rel="alternate" link element for every row, ready for the page head. Ampersands and other attribute-sensitive characters are escaped in the generated HTML.
- Save the block as the cluster source. Store it with the inventory so the same mapping can be installed, reviewed, and regenerated whenever a locale or URL changes.
The generated output is an HTML element set rather than a complete HTML document. Its link relationship and head placement should follow the WHATWG alternate-link guidance. The browser URL parser also normalizes entered addresses, so inspect the normalized URLs before publishing them.
Place the result in the page head
Install the identical complete block in the head of every page in the language cluster. Because the block contains every URL, including a page’s own URL, each page receives both its self-reference and links back to all alternates. A page with only an outgoing declaration is incomplete.
If your publishing platform has a shared template, use that template as the installation point. Otherwise, make sure the same mapping reaches every alternate page through a controlled release process. Do not manually assemble a slightly different set for each locale.
| Implementation method | Fit with this tool | Maintenance requirement |
|---|---|---|
| HTML head elements | Directly matches the generated output | Publish the same complete block on every page |
| HTTP response headers | The generator does not produce header output | Maintain a separate, complete, synchronized set |
| XML sitemap entries | The generator does not produce sitemap XML | Maintain a separate, complete, synchronized set |
Google treats these implementation methods as equivalent, but copying inconsistent declarations across several methods creates drift. Choose the route your publishing system can keep synchronized. If you deploy the generated HTML elements, make sure other methods do not contradict them.
Accept or reject the live setup
Generation proves that the input can be transformed into HTML; it does not prove that the published pages are correct. After deployment, crawl the live pages and check the delivered markup.
- Sample at least one page from every language cluster and inspect the HTML head actually delivered to crawlers.
- Compare the locale-to-URL mapping across the cluster mechanically. Each page should expose the same complete set, not merely a similar list.
- Confirm that every page includes its own URL and that every alternate links back to every other alternate.
- Confirm that each referenced URL resolves to a useful 200 page rather than an unavailable or misleading destination.
- Correct the source inventory, regenerate if necessary, and repeat the comparison after the update is live.
Google documents self and return links as essential signals, and a one-way declaration can be ignored because another site should not be able to claim your page as its alternate unilaterally. The generator cannot access remote pages or prove reciprocity, so this live acceptance check remains your responsibility.
Keep the inventory current when a locale is added, removed, redirected, or moved to a new canonical URL. A synchronized set at launch can become inconsistent later if only some pages are updated.
Separate code checks from SEO decisions
The most important limitation is the boundary between structural validation and search-engine support. The generator canonicalizes a supported tag shape and rejects malformed URLs, duplicate locales, and invalid row formats. It does not consult the complete current language and country registries used by a particular search engine, determine whether a region matches the audience, or judge whether the localized content is truly equivalent.
- Verify every intended language and region separately, using current documentation and the actual content audience.
- Remember that x-default is not a language; it marks a page for users whose settings do not match another listed alternate.
- Use a generic language such as fr only when it serves a useful role alongside country-specific French pages.
- Do not expect hreflang to replace translation, automatic language detection, strong international navigation, or coherent URL architecture.
Once the cluster, input rows, generated block, installation method, and live checks are documented, you have a repeatable hreflang workflow. The generator handles the repetitive tag construction; your review still determines whether the pages, locales, and fallback relationships form a credible international site.
If you're weighing options, How Do I Make Sure I Generate Hreflang Correctly? covers this in detail.
If you're weighing options, How to Plan the Steps Needed to Generate Hreflang covers this in detail.