Canonical Tag
Why you need to declare a representative URL
It is common for a single page to be reachable at several URLs. Google Search Central’s canonicalization documentation lists typical causes of duplicate URLs: http and https protocol variants, mobile and desktop device variants, variants created by sorting and filtering, and the same content reachable at different URLs by region. Google (official) If you don’t specify a representative URL, each of these variants becomes a candidate for indexing.
Google groups pages with similar content, then chooses on its own the page it judges most complete and useful as the representative (canonical). Google (official) If you leave this decision entirely to the search engine, an unintended URL may appear in search results. The canonical tag is the mechanism by which a site says directly, “This is the representative address.” The IETF standard RFC 6596 defines this link relation as “designating the preferred address among a set of resources that return the same content in duplicate form.” RFC 6596
Duplication isn’t a problem for only a few sites. In a 2016 Semrush study analyzing 100,000 sites and 450 million pages, 50% of the sites analyzed had duplicate content issues. Semrush data Cleaning up duplicates ties directly to the efficiency of crawling and indexing.
How to write it and how it works
Add one line in the document head. Google’s documentation recommends using an absolute URL that includes the protocol and domain rather than a relative path, and adding a self-referential canonical, pointing to itself, on the representative page as well. Google (official)
<!-- Accessed URL: https://example.com/works/portfolio-a/?utm_source=newsletter -->
<!-- Declaration in the head: the representative URL is the original without parameters -->
<link rel="canonical" href="https://example.com/works/portfolio-a/" />
A hint, not a command: the gap between guidance and data
The most misunderstood part is how binding it is. Google’s canonicalization documentation states firmly that “indicating a canonical preference is a hint, not a rule.” Google (official) So in practice, the canonical you specify and the one Google actually chooses often differ.
| Google’s official position | rel=canonical is a hint, not a command. Based on other signals such as content quality, internal links, and redirects, Google may choose a different URL as canonical than the one you specified. Google (official) |
|---|---|
| Expert view | It is common for Google to ignore the declared canonical and choose a different URL. Search Console even has a separate status, “Duplicate, Google chose different canonical than user,” and the canonical tag is treated as just one of about twenty canonicalization signals. Ahrefs data |
The gap exists because the canonical tag is not a standalone command but one signal among many. If internal links, sitemaps, and redirects point to a URL other than the canonical, Google effectively follows the majority of signals. So in practice, rather than relying on the single canonical line, the only reliable approach is to make every signal point to the same URL. Google’s documentation also advises against specifying different URLs with different methods. Google (official)
| Aspect | Canonical tag | 301 redirect |
|---|---|---|
| Page access | Both URLs remain accessible | Visiting the original URL sends you to the representative URL |
| Classification in Google’s docs | A strong signal (hint) that the specified URL should be canonical | A strong signal that the redirect target should be canonical |
| Main use | Naming a representative while keeping variant URLs (parameter and sort variants) | Moving URLs, retiring pages, unifying http→https |
If there is no reason to keep both URLs alive, a 301 redirect is the clearer choice. Use the canonical tag when you need to “keep the page but name the representative.”
Practical checkpoints at the theme-building stage
Before leaving it to an SEO plugin, first find out what canonical your theme outputs. WordPress core automatically outputs a canonical for single posts and pages through the rel_canonical hook, but not for custom routes, archives, or search result pages. If you build a custom theme yourself, fill this gap at the theme level and align the output with Google’s recommendations (absolute URL, self-reference, consistent signals). Google (official)
// WordPress core outputs a canonical automatically only for single posts.
// For archives and custom routes, the theme calculates and fills it in.
add_action( 'wp_head', 'jt_output_canonical' );
function jt_output_canonical() {
if ( is_singular() ) {
return; // Core (rel_canonical) already outputs it.
}
global $wp;
// $wp->request includes paths like /page/2,
// so each paginated page references itself.
$canonical = trailingslashit( home_url( $wp->request ) );
echo '<link rel="canonical" href="' . esc_url( $canonical ) . '" />' . "\n";
}
- Always calculate the canonical URL on https and the primary domain, and share the same basis with redirects and sitemaps. Google’s documentation advises against specifying different URLs across methods. Google (official)
- If both the theme and an SEO plugin output one, you end up with two canonicals. Google’s canonicalization troubleshooting documentation lists CMSs or plugins misusing canonicalization methods to point to the wrong URL as a common cause. Google (official) Make sure only one of them outputs it.
- After deployment, check the actual output with View Page Source, and use the URL Inspection tool in Google Search Console to confirm that the “User-declared canonical” and “Google-selected canonical” match. GSC Help Center
Common mistakes
- Wrong canonical from a copied template – When a page template is copied without changing the rel=canonical target, every page ends up declaring the wrong address as canonical. The Google Search Central Blog lists this as a typical mistake. Google (official) Hardcoding the home URL into a shared header is the same type of mistake, so open any subpage right after deployment and check the source.
- Pointing all pagination to page 1 – Google’s pagination documentation advises against using the first page of a series as the canonical and says to give each page its own canonical URL; it also states clearly that rel=”next”/rel=”prev” are no longer used. Google (official)
- https/www variant mismatch – The live site uses the https and www domain, but the canonical points to an http or non-www address. Because the canonical is a hint and not a rule, it can simply be ignored if it conflicts with redirects and sitemaps. Ahrefs data
- Duplicate output – If one document has several rel=canonical tags pointing to different URLs, Google says it is “likely to ignore all the rel=canonical hints.” Google (official)
- Using it together with noindex – Google’s canonical documentation does not recommend using noindex to prevent canonical selection within a site, because it blocks the page from search entirely. Google (official) Keep only the one signal that fits your purpose.
References
- How to specify a canonical with rel=”canonical” and other methods – Google Search Central
- What is canonicalization – Google Search Central
- Fix canonicalization issues – Google Search Central
- Pagination, incremental page loading, and their impact on Google Search – Google Search Central
- 5 common mistakes with rel=canonical – Google Search Central Blog
- URL Inspection tool – Google Search Console Help
- RFC 6596: The Canonical Link Relation – IETF
- Duplicate, Google Chose Different Canonical Than User – Ahrefs
- 11 Most Common On-Site SEO Mistakes – Semrush Study
Jul.2026By Studio JT