In short
A self-referencing canonical is a <link rel="canonical"> tag that points to the very page that carries it. Google recommends placing one on every canonical page. It protects you against variants you do not control: tracking parameters, sort orders, capital letters, copies of the site. The task is to generate this tag in every indexable page template, from a cleaned-up URL, and to identify the cases where the canonical should instead point to another page.
Why it matters
The same page is almost always reachable under several addresses: ?utm_source=newsletter, ?fbclid=…, ?tri=prix, with or without a trailing slash, in capitals from a mistyped link. To a crawler, each is a distinct URL with identical content. Without any hint, Google groups these duplicates and picks the version to keep itself, based on several signals: redirects, presence in the sitemap, protocol, links.
A self-referencing canonical settles this choice in advance. Because it is generated from the clean URL and not from the requested URL, every variant carries the same tag, which designates the reference version. Links pointing to a variant then consolidate their signals on that version.
It is not universal. A page that is itself a duplicate (printable version, color variant with no content of its own, AMP page) must point to the main page. And a self-referencing canonical on a real duplicate is a false declaration, which Google may ignore.
What it improves
- Choice of canonical URL Google more often selects the version you prefer, though the declaration remains a hint, not a rule.
- Consolidation Links to URLs with parameters benefit the clean version.
- Clearer reports Fewer "Duplicate" URLs in Search Console, and statistics grouped under a single address.
- Protection against copies A site that copies your HTML also copies an absolute canonical pointing to you. This is partial protection, which most scrapers strip out.
- Rankings and AI citations No direct effect. Generative engines cite the URL selected in the index; a stable version prevents a parameterized variant from being shown.
How to check
Request the same page in three forms and compare the canonicals:
for url in \
"https://example.com/blog/temperature-infusion-the-vert/" \
"https://example.com/blog/temperature-infusion-the-vert/?utm_source=newsletter" \
"https://example.com/Blog/Temperature-Infusion-The-Vert/"; do
printf '%s -> ' "$url"
curl -s -L "$url" | grep -oiE '<link[^>]*rel="?canonical"?[^>]*>' | grep -oiE 'href="[^"]*"'
done
Expected result: all three lines show href="https://example.com/blog/temperature-infusion-the-vert/". A canonical that repeats the utm_source parameter points to a template that copies the requested URL instead of rebuilding it.
Across the site, the "Self Referencing" filter in Screaming Frog's Canonicals tab lists self-referencing pages, and "Canonicalised" those that point elsewhere: every row in this second filter should be an intended duplicate. In Search Console, the URL Inspection tool compares the declared canonical with the one Google selected.
How to implement
Before you start
Decide, template by template, what the canonical should point to:
| Page type | Canonical | Why |
|---|---|---|
| Indexable page (homepage, article, product page, category, service page) | Itself | This is Google's recommendation for canonical pages |
Page with tracking parameters (utm_*, gclid, fbclid) |
The page without parameters | Same content |
Sort order or display (?tri=prix, ?vue=grille) |
The unsorted page | Same list, different order |
| Page 2, 3… of a paginated list | Itself, with its page number | Google asks you not to designate the first page as the canonical of a series |
Filter turned into a landing page (/thes/the-vert/bio/) |
Itself | Content and intent of its own |
| Filter with no search value | Unfiltered page, or noindex |
See control filters and facets (opens in a new tab) |
| Printable version, AMP, variant with no content of its own | The main page | Deliberate duplicate |
| Language versions | Each one itself | A page must not designate another language as canonical |
noindex page |
No canonical to another page | Conflicting signals |
Construction rule: protocol and domain set in configuration, normalized path (letter case, trailing slash), then only the parameters that actually change the content, such as the page number. Everything else is removed.
Apache
Versions Apache 2.4.10 and later.
For a non-HTML resource, the self-referencing canonical goes in the Link header. Example for all PDFs on the site, which can also be requested with parameters or through another host:
<FilesMatch "\.pdf$">
Header set Link "expr=<https://example.com%{REQUEST_URI}>; rel=\"canonical\""
</FilesMatch>
The expr= syntax (Apache 2.4.10 and later) evaluates %{REQUEST_URI}, the requested path without the query string. Reload with sudo apachectl configtest && sudo systemctl reload apache2, then check with curl -sI https://example.com/documents/guide.pdf | grep -i ^link.
Nginx
Versions Nginx 1.18 and later.
location ~* \.pdf$ {
add_header Link '<https://example.com$uri>; rel="canonical"';
}
$uri is the normalized path, without parameters. Reload with sudo nginx -t && sudo systemctl reload nginx.
WordPress
Versions WordPress 6 and 7; Yoast SEO 20 and later; Rank Math 1.0.
WordPress core writes a self-referencing canonical on posts and pages, including paginated posts. Yoast SEO and Rank Math extend this behavior to categories, tags and archives, paginated pages included, and remove the core tag to avoid duplication.
- Only fill in the "Canonical URL" field in the "Advanced" tab for a real duplicate.
- To change the rule in code, use your plugin's filter (
wpseo_canonicalfor Yoast SEO,rank_math/frontend/canonicalfor Rank Math) or, without a plugin, the coreget_canonical_urlfilter:
add_filter('get_canonical_url', function (string $canonicalUrl, WP_Post $post): string {
if (get_post_meta($post->ID, 'version_imprimable_de', true)) {
return get_permalink((int) get_post_meta($post->ID, 'version_imprimable_de', true));
}
return $canonicalUrl;
}, 10, 2);
This fictional example makes a printable version point to the original article.
Shopify
Versions Online Store 2.0 themes, all plans, November 2026.
Themes write <link rel="canonical" href="{{ canonical_url }}"> in layout/theme.liquid or in a snippet it includes. Use the test in the "How to check" section to confirm that a product page requested via /collections/thes-verts/products/sencha-ariake or with ?variant= does declare the URL /products/sencha-ariake. If an SEO app adds its own tag, keep a single source.
PrestaShop
Versions PrestaShop 1.7.8, 8 and 9 (Classic and Hummingbird themes).
The canonical is produced by the theme (templates/_partials/head.tpl, a block conditioned on $page.canonical). Check that a product combination (#/couleur-rouge or attribute parameters) and sorted category pages declare the main product page or category. An old or customized theme may have lost this block: compare it with the Classic or Hummingbird theme for your version.
Magento
Versions Magento Open Source and Adobe Commerce 2.4.6 to 2.4.9.
In Stores > Configuration > Catalog > Catalog > Search Engine Optimization, set "Use Canonical Link Meta Tag For Categories" and "Use Canonical Link Meta Tag For Products" to "Yes". Product pages reached through a category path then declare the short product URL. Flush the cache in System > Cache Management.
Drupal
Versions Drupal 10 and 11; Metatag module 2.x.
Core writes a self-referencing canonical on content pages. With the Metatag module, set the "Canonical URL" pattern in Configuration > Search and metadata > Metatag, per entity type, and only override it on a content item for a duplicate.
Wix
Versions Wix Editor and Wix Studio, November 2026.
Every page gets a self-referencing canonical by default, which Wix recommends leaving unchanged. Only change it for a duplicate, in the page's advanced SEO settings.
Squarespace
Versions Squarespace 7.1, November 2026.
Squarespace handles canonicals itself, notably on blog tag and category pages, which point to the static page. No per-page setting is needed.
Webflow
Versions Webflow interface (Site settings), November 2026.
Fill in "Global canonical tag URL" in Site settings > SEO (for example https://www.example.com, without a trailing slash): Webflow generates a self-referencing canonical for every page. The "Page canonical URL" field in a static page's SEO settings overrides it for that page only.
Laravel
Versions Laravel 10 to 13.
Build the canonical from the URL without parameters, then add back only those that change the content. A Blade component, resources/views/components/canonical.blade.php:
@props(['keep' => ['page']])
@php
$query = collect(request()->query())
->only($keep)
->reject(fn ($value, $key) => $key === 'page' && (int) $value <= 1)
->all();
$canonical = url()->current().($query === [] ? '' : '?'.http_build_query($query));
@endphp
<link rel="canonical" href="{{ $canonical }}">
In the layout, use <x-canonical />; on a page that is a duplicate, pass a fixed URL instead. url()->current() relies on APP_URL and on trusted proxies: see check canonicals and absolute URLs (opens in a new tab).
Symfony
Versions Symfony 6.4, 7.4 and 8 (Twig 3).
{% set params = app.request.attributes.get('_route_params')|merge(
app.request.query.get('page', 1) > 1 ? {page: app.request.query.get('page')} : {}
) %}
<link rel="canonical" href="{{ url(app.request.attributes.get('_route'), params) }}">
Route parameters form the path; only those added explicitly, here page, go into the query string.
Next.js
Versions Next.js 15 and 16, App Router and Pages Router.
Each page declares its own path, without carrying over the search parameters. Write paths without a trailing slash, unless trailingSlash: true is enabled in next.config.js: otherwise the canonical would point to a redirected URL.
App Router
With metadataBase defined in app/layout.js:
// app/blog/[slug]/page.js
export async function generateMetadata({ params }) {
const { slug } = await params;
return {
alternates: { canonical: `/blog/${slug}` },
};
}
// app/blog/page.js: paginated list
export async function generateMetadata({ searchParams }) {
const { page } = await searchParams;
const pageNumber = Number(page) > 1 ? Number(page) : null;
return {
alternates: { canonical: pageNumber ? `/blog?page=${pageNumber}` : '/blog' },
};
}
Do not define alternates.canonical in the root layout: every page would inherit it and declare itself identical to the homepage.
Pages Router
Without metadataBase, build the absolute URL with an environment variable and next/head:
// pages/blog/[slug].js
import Head from 'next/head';
const siteUrl = process.env.NEXT_PUBLIC_SITE_URL; // https://example.com
export default function Article({ post }) {
return (
<>
<Head>
<link rel="canonical" href={`${siteUrl}/blog/${post.slug}`} key="canonical" />
</Head>
{/* article content */}
</>
);
}
For a paginated list, add ?page=N from page 2 onwards only. Do not put a fixed canonical in pages/_app.js: every page would receive it.
Nuxt
Versions Nuxt 4 (and Nuxt 3, end of life since July 2026).
// app/composables/useCanonical.js
export function useCanonical(keep = ['page']) {
const route = useRoute();
const siteUrl = useRuntimeConfig().public.siteUrl;
const query = new URLSearchParams();
for (const key of keep) {
const value = route.query[key];
if (value && !(key === 'page' && Number(value) <= 1)) {
query.set(key, String(value));
}
}
const search = query.toString();
useHead({
link: [{ rel: 'canonical', href: `${siteUrl}${route.path}${search ? `?${search}` : ''}` }],
});
}
In Nuxt 3, the composables/ folder is at the project root. Call useCanonical() in the <script setup> of every indexable page.
Astro
Versions Astro 5 to 7.
---
// src/components/Canonical.astro
const { href } = Astro.props;
const canonical = href ?? new URL(Astro.url.pathname, Astro.site).href;
---
<link rel="canonical" href={canonical} />
Astro.url.pathname excludes the query string. Only pass href for a duplicate.
Common mistakes
- Copying the requested URL into the canonical: every parameterized variant declares itself canonical, and the tag becomes useless.
- Canonical inherited from a shared layout: every page points to the homepage or the parent category.
- Pages 2 and beyond canonicalized to page 1: products or articles listed further down lose a crawl path.
- Self-reference on a real duplicate: the declaration is false; Google chooses for you.
noindexand a canonical to another page on the same URL: two conflicting instructions.- Canonical to another language: the local version disappears in favor of the other one.
- Two sources writing the tag: theme and plugin, or server and JavaScript.
Frequently asked questions
Should every page have a self-referencing canonical?
Every indexable page that is its own reference version, yes: Google recommends including a canonical tag on the canonical page itself. It ensures that variants with tracking or sorting parameters point to the right URL. Pages that are deliberate duplicates, such as a printable version or a variant with no content of its own, should instead point to the main page.
Does a self-referencing canonical improve SEO?
Not directly: a self-referencing canonical is not a ranking factor. It helps Google select the URL you prefer among the variants of a page and consolidate signals on it, notably links pointing to addresses with parameters. The effect is most noticeable on sites that receive campaign traffic, use sorting or filters, or are reachable through several hosts.
Which canonical for pages 2, 3 and beyond of a paginated list?
Each page of a paginated list should declare its own URL as canonical, page number included. Google explicitly asks you not to designate the first page as the canonical of the whole series: items listed on later pages might no longer be discovered. However, remove sorting or display parameters from the canonical, since they do not change the items shown.
Can you combine noindex and canonical on the same page?
Avoid combining a noindex with a canonical pointing to another page: the noindex asks for the page to be removed from the index, the canonical says it is a duplicate of another page to be indexed, and these conflicting signals leave Google to decide. Choose one of the two. For a duplicate, the canonical to the main page is enough; for a page that must not appear in the results, use noindex alone.
Resources
- Google Search Central: How to specify a canonical URLdevelopers.google.com
- Google Search Central: Pagination and incremental page loadingdevelopers.google.com
- WordPress: wp_get_canonical_url functiondeveloper.wordpress.org
- Shopify: theme SEO metadatashopify.dev
- Adobe Commerce: catalog configuration and SEOexperienceleague.adobe.com
- Next.js: generateMetadatanextjs.org
- Webflow: canonical tags and Wix: changing canonical tagshelp.webflow.com
Updated on
Topic checklist (PDF)