0
0
SeoHow-ToBeginner ยท 3 min read

How to Use Canonical Tag for SEO: Simple Guide

Use the <link rel="canonical" href="URL" /> tag in the <head> section of your HTML to tell search engines which page is the preferred version. This helps prevent duplicate content issues by consolidating ranking signals to the canonical URL.
๐Ÿ“

Syntax

The canonical tag uses the <link> element with rel="canonical" and a href attribute pointing to the preferred URL. Place it inside the <head> section of your HTML page.

  • rel="canonical": tells search engines this link is the canonical version.
  • href="URL": the full URL of the preferred page.
html
<link rel="canonical" href="https://www.example.com/preferred-page" />
๐Ÿ’ป

Example

This example shows a webpage specifying its canonical URL to avoid duplicate content issues when the same content is accessible via multiple URLs.

html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Example Page</title>
  <link rel="canonical" href="https://www.example.com/preferred-page" />
</head>
<body>
  <h1>Welcome to the Example Page</h1>
  <p>This page uses a canonical tag to specify the preferred URL.</p>
</body>
</html>
Output
<!DOCTYPE html> page with canonical tag in head specifying https://www.example.com/preferred-page
โš ๏ธ

Common Pitfalls

Common mistakes when using canonical tags include:

  • Using relative URLs instead of full absolute URLs in the href.
  • Pointing the canonical tag to a non-existent or incorrect URL.
  • Setting canonical tags that point to different domains without proper cross-domain setup.
  • Not using canonical tags on duplicate or very similar pages.

These errors can confuse search engines and harm SEO instead of helping.

html
<!-- Wrong: relative URL -->
<link rel="canonical" href="/preferred-page" />

<!-- Right: absolute URL -->
<link rel="canonical" href="https://www.example.com/preferred-page" />
๐Ÿ“Š

Quick Reference

Remember these tips when using canonical tags:

  • Always use the full absolute URL in the href.
  • Place the tag inside the <head> section.
  • Use canonical tags on pages with duplicate or very similar content.
  • Do not use multiple conflicting canonical tags on the same page.
  • Test your pages with SEO tools to verify canonical tags are recognized.
โœ…

Key Takeaways

Use the canonical tag to tell search engines the preferred URL for duplicate content.
Always use a full absolute URL in the canonical tag's href attribute.
Place the canonical tag inside the section of your HTML page.
Avoid common mistakes like relative URLs or pointing to wrong pages.
Use SEO tools to check that canonical tags are correctly implemented.