Error – Combining Multiple Country or language codes
April 17, 2018
Error – Canonical is Self-referencing HREFLang Entry
April 17, 2018

Error – Combining HREFLang and Canonical Tags

Search Knowledge Base by Keyword

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=”http://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=”http://www.mysite.com/ar/”/>