Introduction
Canonical Tag in HTML tells search engines which URL is the preferred version of a page. It prevents duplicate content issues that could hurt your SEO rankings.
Canonical Tag Example
<head>
<link rel="canonical" href="https://example.com/sample-page/" />
</head>
How It Works
The rel="canonical" attribute signals to Google which page is the “master” version. All duplicate or similar URLs consolidate their ranking signals into the canonical page.
Why Use This?
Without a canonical tag, search engines may index multiple versions of the same content, splitting your SEO power across duplicates.
Common Mistake
Pointing every page to the homepage using a canonical tag is a big mistake. Each page should point to itself unless you want to merge duplicates.
Pro Tip
Always use absolute URLs (with protocol and domain) in your canonical tags. Relative paths can cause unexpected indexing issues.