Search Knowledge Base by Keyword

Table of Contents
< Back
You are here:
Print

Error – Combining HREFLang and Canonical Tags

This is another mistake I am seeing more and more where developers try to combine the canonical and the self-referencing hreflang element into a single tag.  In this case, it was the page for Ireland English.

<link rel=”Canonical” hreflang=”en-IE” href=”https://www.mysite.com/ie/”/>

<link rel=”alternate” hreflang=”es-AR” href=”https://www.mysite.com/ar/”/>

 Clarification:  The rel=canonical must be its one entity as must the hreflang element for the page.  You cannot combine them under any conditions. A correct entry would look like the code below.

<link rel=”canonical” href=” https://www.mysite.com/ie/”/>

<link rel=”alternate” hreflang=”en-IE” href=”https://www.mysite.com/ie/”/>

<link rel=”alternate” hreflang=”es-AR” href=”https://www.mysite.com/ar/”/>

Table of Contents