hreflang in body

warning hreflang-in-body hreflang and language versions

`` placed in `` — usually a language-switcher component that prints the alternates where it renders. Search engines read hreflang only from `` (or the sitemap, or HTTP headers), so these links are not counted as alternates at all, and the reciprocity checks see the page as having none.

What indexgap reports

The finding reads:

warning  hreflang-in-body  … hreflang links sit in <body> — search engines read them only from <head>, so they link no versions. Move the markup into <head>

How to fix it

Move <link rel="alternate" hreflang> into the template's <head>: the component that renders the language switcher in the page body is not the place for alternates markup.

How it behaves at scale

Collapsed when it fires template-wide. If it appears on 90% or more of the pages — or of one language version — of a site with at least 20 pages, it is a property of the template and is reported once, with the count, instead of once per page.

Finding it

pipx install indexgap
cd your-project
indexgap init
indexgap check

Then indexgap brief turns every finding on this page into a work order in indexgap-briefs/, with the thresholds the result has to satisfy and the command to check it.

Related checks in hreflang and language versions

All checks · hreflang and language versions