hreflang outside <head> medium
hreflang link element placed outside the <head>
hreflang <link> tags rendered into the <body> are ignored by Google, so language and regional targeting silently does nothing.
What you see
No hreflang found — or, in a crawler — hreflang annotation in <body> will be ignored Link element with hreflang is not inside <head>
What’s actually happening
You added rel="alternate" hreflang links, but Search Console's International Targeting report shows no hreflang tags, and the wrong-language page keeps ranking in the wrong country. View-source shows the tags sitting after <body> or inside a component partial that renders into the page body. The HTML inspector in DevTools shows them, but a raw fetch of the source does not place them in <head>.
Common causes
- A JavaScript framework or component injects the hreflang <link> into the DOM body after load instead of server-rendering it into <head>.
- A tag manager (e.g. GTM) writes the tags via a custom HTML tag, which fires inside <body>.
- A malformed <head> — an unclosed tag or a stray <body>-only element — causes the browser to close <head> early, so subsequent links land in <body>.
- The hreflang block was pasted into a content area or template region that outputs inside the body, not the document head.
- Tags are added by client-side rendering only, so the HTML Googlebot reads before rendering has them in the wrong place or not at all.
How to fix it
- Move the tags into <head> server-sideRender every <link rel="alternate" hreflang="..." href="..."> inside <head> in the initial HTML response. Confirm with curl -s https://example.com/page | grep -i hreflang — the lines must appear before </head>.
- Validate the <head> closes correctlyRun the page through the W3C validator. An unclosed <meta>, <title>, or a misplaced <div> can terminate <head> early and dump everything after it into <body>.
- Stop injecting hreflang via tag managerGTM and similar tools inject into <body>, so Google won't count those hreflang annotations. Remove the tag-manager version and emit hreflang from the page template or the server.
- Or switch to the HTTP header / sitemap methodFor non-HTML files or when you can't touch the markup, send a Link: <url>; rel="alternate"; hreflang="x" HTTP header, or declare hreflang in your XML sitemap. Both keep the annotation out of the body entirely.
- Re-test the rendered sourceUse Search Console's URL Inspection → View Crawled Page, or the Rich Results Test, to confirm the rendered <head> contains the hreflang set Google actually sees.
Stop it recurring
Keep all hreflang generation in the document <head> via your server template, and add a crawl rule that flags any rel=alternate hreflang link found outside <head>.
Related errors