Canonical Chaos: Why Your Site is Fighting Itself

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:

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.

Spam, but handcrafted sometimes. resource
Spam, but handcrafted sometimes.

Not polished, not even regular. Just stray thoughts shoved into an email because that's what you do on the internet.