In practice, it’s just a tiny HTML tag <link rel="canonical"> that stops duplicate URLs fighting each other in search.
When it works, duplicate content collapses into one clean URL.
When it doesn’t, Google picks whatever version it feels like – sometimes the worst one.
And that’s where the canonical chaos kicks in.
How Sites Screw This Up
Canonical chaos looks like this:
/pagevs/page/→ two URLs, same content, double the mess.http://vshttps://→ are we seriously still doing this in 2025?- Every single page pointing to
/→ congrats, your entire site is one page now. - Query strings sneaking into canonicals →
?utm_campaign=fakeguruforever immortalized.
Bad example:
<link rel="canonical" href="https://example.com/?utm_campaign=garbage">Good example:
<link rel="canonical" href="https://example.com/page">It’s like naming every single file on your laptop “final-v2-FINAL-this-one.pdf.” You know it’s a disaster. Google does too.
How to Stop the Chaos
Here’s how to stop pissing off search engines:
1: Pick a format and stick with it.
Always HTTPS. Decide on trailing slash or not – just be consistent.
2: Set the canonical yourself
<link rel="canonical" href="https://example.com/page">
3: Strip the junk.
Canonicals should never include UTMs, session IDs, or random tracking crap.
4: Audit your site.
Crawl it. If every page canonicals to /, fix it before Google buries you.
A Cleaner Canonical in Code
Here’s a simple Express/Node fix that outputs clean canonicals without query strings:
app.use((req, res, next) => {
const url = new URL(req.protocol + '://' + req.get('host') + req.originalUrl);
url.search = ''; // strip query strings
res.locals.canonical = url.href;
next();
});Template example:
<link rel="canonical" href="<%= canonical %>">Canonical tags aren’t some mystical SEO hack. They’re name tags for your pages.
Get them wrong, and Google will call you by the wrong name – and maybe forget you exist at all.
