SEO
Canonical URL
Tells Google which version of a URL is the "real" one - prevents duplicate content from splitting your search rankings.
medium severityWhat is this?
Your page might be accessible at multiple URLs: yourdomain.com/page, yourdomain.com/page/, www.yourdomain.com/page, yourdomain.com/page?utm_source=twitter. Without a canonical tag, Google might index all of these as separate pages.
<link rel="canonical" href="https://yourdomain.com/page">
This tells Google: "This is the definitive URL for this content. Please consolidate all link signals here."
Why it matters
- PageRank dilution. If 5 URL variants all rank, each gets 1/5 of the link equity instead of all signals going to one URL
- Crawl budget waste. Google spends crawl budget on duplicate pages instead of finding new content
- Wrong URL in search results. Google might show a query-parameter URL or www variant as the search result
How to fix it
Add to your <head> on every page:
<link rel="canonical" href="https://yourdomain.com/current-page">
The URL should be the preferred, stable version - always use https://, without trailing slashes (or consistently with them), and without UTM parameters.
Providers & tools
| Framework | How to set canonical |
|---|---|
| Next.js App Router | export const metadata = {
alternates: { canonical: 'https://yourdomain.com/page' }
}; |
| Next.js Pages Router | <Head> <link rel="canonical" href="https://..." /> </Head> |
| Astro | canonicalURL in frontmatter, rendered in layout head |
Check if your domain has this issue