Canonical tag
Canonical tags are a vital part of the technical side of search engine optimization (SEO). In this short guide, you can learn more about canonical tags - what they are, why you should use them and how to set them up and use them in practice.
- Home page " Dictionary " Canonical tag
- Last updated:
What is a canonical tag?
A canonical tag is a piece of code in the HTML of your website that tells Google which of several identical pages to index and display in search results.
This is especially relevant on eCommerce sites where the filter function on product pages can have multiple URLs due to the filter function. But it can also be relevant on websites with multiple language layers, if you reuse content on multiple URLs or if a page can be accessed via multiple addresses - typically with and without www. or with and without https://.
The page whose URL you use in your canonical tag will be the canonical URL. Read more about canonical URLs on Google Developers.
Why are canonical tags important?
Duplicate content is a no go in SEO, as Google penalizes duplicate content with lower rankings. In addition, reused content can make it difficult for Google crawlers to index your website and choose the URL you want to rank for a desired keyword.
Let me give you an example from the real web world - specifically H&M's Danish webshop. Here you will find a category page with dresses. On the page, you can sort by color, size, length and a lot of other parameters. This is potentially an SEO pitfall, because in the eyes of the search engines it results in a myriad of URLs with duplicate content, as the URL will change with each filtering.
Here is the original URL of the page as well as the URL after filtering for beige dresses.
https://www2.hm.com/da_dk/dame/produkt/kjoler.html
https://www2.hm.com/da_dk/dame/produkt/kjoler.html?sort=stock&colorWithNames=beige_f5f5dc&image-size=small&image=model&offset=0&page-size=36
This is where canonical tags come in - and H&M's SEO team knows this. That's why they have set up a canonical tag that contains the page's URL without filters - this URL is the canonical URL.
This means that the canonical URL will always be https://www2.hm.com/da_dk/dame/produkt/kjoler.html, even if the URL changes for each filtering.
See our full SEO dictionary
How to set up canonical tags
Canonical tags skal bo i <head>-sektionen i din hjemmesides HTML – her er det dog vigtigt at understrege, at hver underside på din hjemmeside skal tildeles et canonical tag. I praksis skrives tagget således:
If you have multiple pages with identical content, insert the tag on the page you want to be included in Google's index and thus appear in the search results - in other words, the most important of the identical pages.
Most CMSs will automatically insert the page URL into the canonical tag. These are called self-referential canonical tags. But if you have multiple pages with the same content, you should insert the main page URL in the canonical tag of the alternative pages. This ensures that Google only crawls your main page. This frees up your crawl budget and prevents confusion from Google.
If you use WordPress, you can use Yoast SEO (an SEO plug-in) to set a canonical URL under 'Advanced'.
På meget store hjemmesider med mange versioner af hver side kan du vælge at automatisere processen, så du ikke behøver at tygge dig igennem opsætningen af canonical tags på 50 forskellige URL’er. Det gør du ved at indsætte følgende generiske kodestykke i hjemmesidens <head>-sektion:
This code snippet ensures that the page URL is self-referential - preventing filter functions from ruining your SEO work. This way, you can pull off the same trick as the SEO team at H&M.
More concepts
Want to learn more digital marketing terms? Our digital dictionary is full of them - and we're constantly updating it.