← Back to Blog
SEONext.jstechnical SEOVercel

One Wrong Constant Cost Me Three Months of Indexing

Search Console reported 33 redirect errors and half my pages missing from the index. The cause was a single string, and every symptom traced back to it.

SPSantosh Paudel· September 6, 2026· 6 min read
Table of contents

My site had been live for three months. Impressions were climbing, positions were improving, and clicks were flat at almost zero. Search Console listed 33 pages with redirect problems and showed 208 of 389 sitemap URLs indexed.

The cause was one line:

export const SITE_URL = 'https://santoshpaudel.me'

Vercel was serving www. That constant said non-www. Everything downstream inherited the mistake.

Why one string did that much damage

Every SEO surface on the site derived from that constant:

  • the sitemap — all 389 URLs
  • every <link rel="canonical">
  • robots.txt's Host directive
  • every OpenGraph and JSON-LD URL

So the sitemap handed Google 389 URLs that all answered with a 308 redirect. And the page Google did reach carried a canonical tag pointing at the URL that redirected back to it.

That is the part that does the damage. A canonical pointing at a redirect gives the crawler contradictory instructions: this page says the real version lives over there, and over there says it lives here. Google resolves that by picking one itself, or by not indexing confidently at all.

The symptom list in Search Console was one bug wearing four costumes:

ReportedActually
Page with redirect (33)Sitemap URLs answering 308
Redirect error (3)The canonical loop
Alternate page with proper canonicalSame
208 of 389 indexedCrawl budget spent on redirects

The symptom that gave it away

The Pages report listed the same post twice:

/blog/starting-podcast-2026...   49 impressions   position 10.22   (www)
/blog/starting-podcast-2026...   49 impressions   position 11.24   (non-www)

One post, competing with itself, at half strength on each hostname. Neither reached page one. Six other posts showed the same split.

The clearest tell was my own name: santosh paudel — 23 impressions, position 9. Google did not know which hostname was me.

The fix

export const SITE_URL = 'https://www.santoshpaudel.me'

One line, because everything routed through the constant. The only real work was finding the places that had bypassed it — the root layout had hardcoded the hostname separately, including metadataBase, which resolves relative metadata URLs for the entire app. Fixing the constant alone would have left it behind.

Worth grepping for:

grep -rn "yourdomain\.com" --include=*.ts --include=*.tsx app lib components \
  | grep -v "SITE_URL"

What I would check on any site

Three commands, two minutes:

# 1. Which hostname actually answers 200?
curl -sSI https://example.com/ | head -1
curl -sSI https://www.example.com/ | head -1

# 2. Does the sitemap agree with it?
curl -sS https://www.example.com/sitemap.xml | grep -c "<loc>https://www\."

# 3. Does the canonical point at itself?
curl -sS https://www.example.com/some-page \
  | grep -oE '<link rel="canonical" href="[^"]*"'

If the canonical does not match the URL that returns 200, stop and fix that before anything else. No amount of content or links compensates for a crawler that cannot decide what your page's address is.

The lesson I actually take from it

I spent three months reading the symptoms as a content problem. Positions were mid-page, so I assumed the content needed to be better. The content was fine. The plumbing was telling Google two different things about every page on the site.

Check that the machine is plugged in before rewriting what it prints.

Free resource

Get the AI-SEO Content Checklist

A practical checklist for getting your own content cited by Google AI Overviews, ChatGPT, and Perplexity — not just ranked.

No spam. Unsubscribe anytime.

Browse all free guides →

Run this on your own numbers

Content ROI & Payback Calculator — free, no signup, runs in your browser.

Open the calculator →

Want to implement this with guidance?

Santosh helps founders turn insights like this into real systems.

SEO Content Strategy

External Resources

Further Reading & Tools

Related Posts

01
13 min
SEOContent Strategy
TodayAnalytics & Data Marketing

Zero-Click Search ROI: My Content Payback Math

My site earned 22 clicks from 4,553 impressions in 85 days, a 0.48% CTR. I put that number through a content payback model. At my real impression yield the programme would need a 42.5% CTR to break even.

Read article
02
12 min
SEOContent Strategy
TodayCase Study

389 Pages, 22 Clicks: A Teardown of My Own Site

Search Console gave my site 22 clicks from 4,553 impressions in 85 days. Here is the full teardown: the bad numbers, the cut from 267 posts to 103, and the outcome I cannot claim yet.

Read article
03
12 min
SEOAutomation
TodayTechnical

llms.txt in Next.js: What Reads It and What Does Not

Google has not endorsed llms.txt and Ahrefs found 97% of them get zero requests. Here is why I ship one anyway, the two dead links my hand-written file was recommending, and the route handler that replaces it.

Read article