Technical6 min readEntry updated

Hreflang for adult websites: getting every language version in front of the right people

Hreflang tells search engines which language or regional version of a page to show to whom. It is simple in principle and easy to get wrong in practice, and adult sites add a twist: age-gated and noindex pages that should never be part of the set.

Illustration of an open passport page with language code stamps

01Three ways to add it

MethodWhere it livesBest for
HTML tagsIn the head of each pageMost sites; easy to check by viewing the source
HTTP headersSent with the fileNon-HTML files such as PDFs
XML sitemapListed per URL in the sitemapLarge sites where editing every page is impractical

Pick one method per set of pages and stick with it; mixing them makes errors harder to find.

02The rules that matter

  • Every version lists itself and every other version in the set.
  • Links go both ways; a one-way reference is ignored.
  • Language codes use ISO 639-1, such as fr or de; an optional region uses ISO 3166-1, such as en-GB.
  • Use full URLs, including https, and the canonical address of each page.
  • Add x-default for visitors whose language you do not cover.

03A worked example

<link rel="alternate" hreflang="en-GB" href="https://example.com/uk/" />
<link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
<link rel="alternate" hreflang="de" href="https://example.com/de/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />

The same four lines appear on every one of those pages, each listing itself and the others.

04The adult-site twist

Hreflang should connect only open, indexable pages. Never include age-verification screens, gated pages or anything marked noindex in a hreflang set, and never point x-default at the age check. If a page is open in one market but gated in another, the two are not equivalents and should not be linked by hreflang. The site-level picture is in our entry on international structure.

05Checking your work

  1. View the source of a few pages in each language and compare the sets.
  2. Check each URL in the set opens without an age check and is indexable.
  3. Look for region codes such as en-UK that do not exist.
  4. Recheck after any redesign or migration, when hreflang often breaks.

The service behind this is multilingual SEO.

06Three ways to add hreflang

Google accepts hreflang in three places: link elements in the page head, HTTP headers, and XML sitemaps. Head tags are the simplest for most sites. HTTP headers suit files that have no head, such as PDFs. Sitemaps suit large sites, because the whole set lives in one file per language rather than in every page. Pick one method and use it consistently across every language; mixing methods makes errors much harder to find.

07An example set

Versionhreflang valuePoints to
English, defaulten and x-default/
Frenchfr/fr/
German for Germanyde-DE/de/
German for Austriade-AT/at/

Every page in the set carries all four lines, including the one for itself. If a page has no equivalent in one language, simply leave that language out of the set for that page rather than pointing to a near match.

08Errors that are easy to miss

  • Hreflang pointing to a URL that redirects or returns an error.
  • Hreflang pointing to a page marked noindex, or to a page whose canonical points elsewhere.
  • Gated or age-check URLs included in the set.
  • Uppercase, underscores or made-up codes, such as en_UK instead of en-GB.
  • Pages added in one language without updating the sets on the others.

09Regional variants

When you serve several countries in one language, hreflang can tell search engines which regional page suits which searcher, such as fr-FR, fr-BE and fr-CH. This only helps if the pages genuinely differ in prices, delivery or legal details. If they are the same apart from a flag, a single language version with clear country information is usually simpler and avoids near-duplicate pages.

10Choosing an x-default

The x-default tells search engines which page to show people whose language or region you do not target. Most sites point it to a language chooser or to their English home page. For adult sites, make sure the x-default page is open and safe for work, not an age-check screen, so that searchers anywhere see something useful first.

11Keeping hreflang right over time

Hreflang breaks when sites change. New products launched in one language, old pages removed in another, URL changes after a redesign: each can leave sets pointing to pages that no longer exist. Generate hreflang from your CMS or sitemap automatically rather than by hand, and run a crawl that checks every set each month. Search Console reports some problems, but a crawler catches more of them sooner.

12Testing before and after launch

Before launching a new language, crawl the staging site and check that every page has a complete, reciprocal set. After launch, inspect a sample of URLs in Search Console for each language, and watch which version appears for test searches made from each country. The structure behind it is explained in our guide to international site structure.

13Hreflang and the age check

Adult sites need one extra rule. The pages in an hreflang set should be open pages that search engines can index in every language. Age-check screens, gated galleries and pages behind login do not belong in any set. If a market requires a stricter check, place it in front of the gated section for that market, and keep the open pages in the set unchanged, so each language still has a complete, indexable front.

14Large sites and sitemap-based hreflang

On sites with thousands of products in several languages, adding hreflang to every page head makes pages heavier and harder to maintain. Listing the sets in XML sitemaps, one file per language, keeps pages lighter and puts the whole map in one place your developers can generate automatically. Search Console reads these sitemaps and reports errors per file, which makes problems easier to trace. Choose this route early; switching methods later means rebuilding the sets.

15When hreflang seems to be ignored

Hreflang is a hint, not a command. If the wrong version keeps appearing, check that the pages are genuinely in different languages, that each is indexed, that canonicals point to themselves, and that internal links point to the right versions. Search engines weigh all of these together, and hreflang alone rarely overrides a strong contrary signal. Duplication problems are covered in our guide to multilingual duplication.

16A short checklist

  • Every open page lists itself and every equivalent, with valid codes.
  • Every link is reciprocal and points to a live, indexable page.
  • No gated, age-check or login pages appear in any set.
  • An open, safe-for-work x-default is defined.
  • Sets are generated automatically and checked by a monthly crawl, with results kept for comparison.

The service that sets this up is described on multilingual SEO.

17References

Official and research sources referred to above, linked to their home pages.

QQuestions

Is it en-UK or en-GB?

en-GB. The region part uses ISO 3166-1 country codes, and the code for the United Kingdom is GB.

Should x-default point to the age check?

No. Point it to an open page, such as a language selector or your main version, never to a verification screen or a gated page.

Do we need hreflang if every language has its own domain?

Yes, if the pages are equivalents. Hreflang works across domains as well as within one.

Free market review

Before you go abroad, see where you stand

Tell us which countries and languages you have in mind. We look at your site's structure, language signals and the rules in each market, then reply with a written plan for the first market. There is no charge and no commitment.

Request a free market review