Dev.to WebDev 🛠 Dev 👁 0 📖 1 min read

I spent 2 days debugging why Google wouldn't index my new SaaS — the bug was in my own canonical tags

Launched a new site two days ago and Google Search Console showed zero indexing. Spent longer than I'd like to admit assuming it was just "new domain, be patient" — until I actually checked the live HTML. The

Launched a new site two days ago and Google Search Console showed
zero indexing. Spent longer than I'd like to admit assuming it was
just "new domain, be patient" — until I actually checked the live HTML.

The bug

My server correctly redirects uxtion.ai → www.uxtion.ai (301/308).
Standard setup. But every canonical tag on the page — and the JSON-LD
schema, and the sitemap — still pointed back to the non-www version.

So Google was getting two contradicting signals on the same page:

  • "The real URL is www" (from the redirect)
  • "No wait, the real URL is non-www" (from the canonical tag)

Classic case of shipping the redirect and forgetting the metadata
has to agree with it.

The fix

Pulled every hardcoded domain reference into a single shared constant
tied to the actual production env var, instead of a string typed out
in six different files. Once that shipped and the sitemap re-read
correctly, the homepage went from "not indexed" to "URL is on Google"
within a few days.

Why I'm writing this

I'm building UXtion — a tool that audits Lovable
and Cursor-built sites and hands back paste-ready fixes instead of
another report to interpret. Ironically, this bug was in my own
marketing site, not a customer's. Turns out "diagnose the problem vs.
actually fix it" applies to your own infrastructure too.

If you're running a Next.js App Router site with a www/apex split,
worth checking alternates.canonical and any JSON-LD @id/url
fields aren't hardcoded to the wrong domain — tsc and your test
suite won't catch this, only a live view-source will.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.