What Is a Canonical Tag?
The canonical tag (<link rel="canonical" href="...">) tells search engines which version of a page is the "master" copy when multiple URLs serve similar or identical content.
Common Duplicate Content Scenarios
- HTTP vs HTTPS — both may be accessible
- www vs non-www — choose one
- Trailing slashes —
/pagevs/page/ - URL parameters —
/products?sort=pricevs/products - Print versions —
/page?print=true
Implementation
Add to the <head> of every page:
<link rel="canonical" href="https://yourdomain.com/the-canonical-url" />
In Next.js App Router:
export const metadata = {
alternates: { canonical: 'https://yourdomain.com/your-page' }
};
Self-referencing Canonicals
Even pages with no duplicates should have a self-referencing canonical. This prevents third-party content scrapers from outranking you with copied content.
Canonical vs. Redirect
If content has moved permanently, use a 301 redirect rather than a canonical. Canonicals are hints that Google may choose to ignore. 301 redirects are directives that Google always follows. After fixing canonicals, resubmit priority URLs with our index pages faster workflow.