The canonical tag is an HTML element that helps webmasters prevent duplicate content issues on their websites. It is used to specify the “canonical” or “preferred” version of a web page, and it looks like this:
To use the canonical tag, you need to add it to the
section of the HTML code for each page on your website. The href attribute should contain the URL of the canonical version of the page, which is the version you want search engines to index and display in search results.For example, if you have multiple versions of a page with slightly different URLs (e.g. /page-1, /page-1?ref=home, etc.), you can use the canonical tag to specify which version is the “preferred” one. This tells search engines which version of the page to display in search results, and helps prevent them from indexing and potentially ranking multiple versions of the same content.
Using the canonical tag can help improve the SEO of your website, and it is generally considered a good practice to use it on all of your web pages.