HTTP header hreflang example

The most uncommon location for the hreflang to be found is within the head of the page. This means that it's received in a GET request from the server, this is particularly useful for non html content.

Why Utilise the HTTP header for hreflang?

The primary recommendation for serving hreflang within the HTTP header of the page is because the content served is non HTML and instead either an image or PDF.

Our hreflang validation test picks up this and if you already have it implemented you can test it on the homepage

Example python code
import requests print(requests.get('').headers)
Response of this URL

{'Content-Length': '13829', 'Content-Type': 'text/html; charset=utf-8', 'Date': 'Wed, 17 Jun 2020 20:12:55 GMT', 'Link': '; rel="alternate"; hreflang="fr", ; rel="alternate"; hreflang="de", ; rel="alternate"; hreflang="en"', 'Server': 'Caddy, gunicorn/19.8.1', 'X-Frame-Options': 'SAMEORIGIN'}