Small SEO Tools

How to Add x-default Hreflang to a Language Selector

Your site has English and French homepages, plus a start page where visitors choose a language. Which address should be the fallback in its hreflang annotations? This walkthrough builds one small homepage group and then checks the selector itself, where a correct tag can still lead to a confusing experience.

Give the selector a clear job

x-default identifies a fallback URL when the listed languages or regions do not match. It can point to a language selector, rather than choosing one translation as the default. Google explains this fallback role. The annotation does not create the selector, detect a visitor’s language or program a redirect.

For this fictional site, the English and French homepages introduce the same service. The root homepage offers two visible choices leading to those editions. These illustrative addresses are placeholders; replace them with your own real pages.

Page URL Value
English homepage https://example.com/en/ en
French homepage https://example.com/fr/ fr
Homepage language selector https://example.com/ x-default

Keep this mapping scoped to the homepages. Do not label an English pricing page and a French contact page as translations of each other. For a translated article, plan its own corresponding URLs and appropriate fallback. Our language and regional hreflang guide covers that broader mapping process.

Generate one shared block

Open the Hreflang Tag Generator and use its two initial language rows:

  1. Enter https://example.com/en/ in the first Page URL field. Select English (en) and leave Region (optional) at No region.
  2. Enter https://example.com/fr/ in the second row. Change Language to French (fr), with No region.
  3. Click Add x-default row. Enter https://example.com/ in x-default URL.
  4. Click Generate Tags and inspect the HTML link tags output before copying.
<link rel="alternate" hreflang="en" href="https://example.com/en/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />

The first two lines identify the translated homepages. The last line names the selector without assigning it an extra language code. This generator formats your entries; it does not fetch the addresses or confirm that the pages contain reciprocal annotations.

Check the second row before copying

Both initial rows start with English selected. Forgetting to choose French creates a duplicate language value. If a line disappears or the tool reports a duplicate, fix the row rather than assuming the shorter output is complete. For our mapping, expect three distinct values and three intended addresses.

Install the same set on all three homepages

Use the site’s existing multilingual integration to place this block in each page’s <head>. The English homepage references itself, French and the selector. French carries the same list; so does the selector, whose own reference uses x-default. Fully qualified addresses, self-references and return links are part of Google’s localized-page requirements.

A frequent installation mistake is adding the fallback only to the selector template while leaving the English and French templates unchanged. Review all three outputs after deployment. If a plugin already writes hreflang, edit its relationships through that integration instead of adding a competing manual block. Do not paste these tags into the visible page content.

Test the choices, then the annotations

Open the selector in a fresh browser session. It should let you reach both homepages through ordinary visible links. Then visit each language URL directly and check that the page stays accessible. Google recommends user-controlled language switching and warns that automatic redirects can hide versions from users and crawlers.

Use a three-row review sheet: requested URL, actual destination and observed hreflang set. View source for each page and compare its head annotations with the saved block. Check for omitted lines, old paths and duplicate entries. If French still names an obsolete selector address, update the shared mapping and repeat the check on all three pages.

Finally, choose both languages on a phone and confirm the selected homepage presents the intended service. Keep the review sheet with your deployment notes so a future homepage move triggers another check. Hreflang expresses page relationships; it does not guarantee which result Google will show or promise higher rankings.