← All Writing
February 18, 202611 min read

How to Set Up Your Site So Google Can Actually Find It

I finished building this site yesterday. Before I write anything else on it, I want to be certain Google can actually find what I publish — because publishing a page and having Google know it exists are two different things. On a hosted platform that gap is usually handled for you; on a custom-built site it can quietly go unchecked. So here is the setup, done first.

YieldA site whose every page — including every post not written yet — lands in the sitemap automatically, served from one canonical domain, and registered with Google before there is any content to lose
DifficultyBeginner-friendly (one small file, one redirect rule, and a free Google dashboard — no SEO agency, no plugins, no keyword tools)
Total Cook Time~1 hour to wire up, then a five-minute check whenever you wonder — but expect weeks, not days, before search reflects any of it

Ingredients

Why This Is Worth Five Minutes

Inbound traffic comes from essentially three places: search, self-promotion, or paid ads. Self-promotion doesn’t scale past the people who already know you. Ads stop the instant you stop paying. Organic search is the only one that compounds — it works while you sleep, on something you wrote a year ago. So a plumbing bug in search isn’t a channel performing badly; it’s the quiet deletion of the only channel that keeps going after you stop pushing. Worth five minutes to rule out.

I just spent a few sessions building this site from scratch with Claude. Everything visible works. But “it loads in my browser” only proves a visitor who already has the URL can reach it — Google finding a page is a separate process, and there is no error message when it doesn’t happen. That seems like a bad thing to discover a year from now, so I’m doing it on day two.

The Short Version

If you read nothing else, read these three lines.

Step 1: Find Out What Google Actually Has

I registered the site in Search Console and submitted the sitemap before writing this post, which is the whole point — install the instrument before you need the reading. On a site this new Google has essentially nothing yet, and that’s fine; what matters is that the dashboard now exists, so the day something looks wrong I can see it rather than guess.

The one setup choice worth thinking about is which kind of property to register. I picked the domain-level one, which covers the apex and the www address and every subdomain in a single view — useful precisely because the www-versus-apex split is the other thing worth settling early.

🔧 Developer section: Search Console setup

Step 2: Your Sitemap Probably Lists Your Nav, Not Your Content

I wired app/sitemap.js to generate from the same array that renders my writing index, rather than listing paths by hand. The result is that every post I publish from now on adds itself, and I never have to remember this again. A sitemap is a machine-readable list of every URL you want Google to look at — crawlers can find pages by following links, but this is the one place you say explicitly: here is everything.

The mechanics are simpler than they sound. In the Next.js App Router you never write XML — you export a function that returns a list of objects, and the framework renders the file. The only real trap was dates: my posts store theirs as human-readable strings, which JavaScript will happily turn into an invalid date if you let it.

🔧 Developer section: Generating the sitemap from the posts array

localhost:3000/sitemap.xml — what to look for
# the failure mode — hardcoded static paths only
/ /about /work-and-projects /writing /contact
...and not one post

# what you want — posts imported from app/lib/posts.ts
the static routes + one <url> per post, each with its own date
count them; the total should match what you have published

The check that takes ten seconds and is the only verification available before you hand the file to Google.

Step 3: Pick One Domain and Enforce It in Code

I picked the apex as canonical and enforced it with a path-preserving 308 redirect in next.config.ts, then pointed the sitemap and robots.js at the same host. Now www answers with a redirect and the apex answers with the page — one address, no split. Most sites answer on two: the apex (example.com) and the www version. To you that’s one site; to a crawler it’s two hosts serving identical content, which splits your signal and makes Google guess which you meant.

The rule itself is one object in the config file, but two details in it do all the work: a condition so it only fires on the www host, and a wildcard so the rest of the URL survives the trip. Get either wrong and you either loop forever or dump every visitor on the homepage.

🔧 Developer section: Enforcing the canonical host

Why in code, not in the dashboard

Most hosts will do a www redirect for you with a toggle in their control panel. I put mine in next.config.ts instead, as a rule matching on the host header. A redirect in the repo is visible to anyone reading the code, moves with the project if I change hosts, and gets reviewed like any other change. One in a dashboard is invisible, undocumented, and a password reset away from being lost. Infrastructure you can’t see in git log is infrastructure you will eventually be confused by.

Step 4: Submit, Then Measure the Right Number

I submitted the sitemap and now the only sensible thing to do is nothing for a few weeks. This is where people quit: you ship the setup, check a week later, clicks haven’t moved, and it looks like nothing worked. Clicks are the wrong number to be watching that early.

Impressions are the leading indicator

An impression is your page appearing in somebody’s search results — they saw it, whether or not they clicked. A click is the whole chain completing: indexed, ranked well enough to be on a page someone scrolled, and appealing enough to beat every other result. Impressions move first, by weeks; clicks are downstream of both impressions and ranking position. Judge an indexing setup by clicks in week one and you will always conclude it failed.

Two Things That Will Look Like Bad News

Both of these are normal, and both are the kind of thing that makes people undo a working change. Worth knowing before you see them.

Your average position will get worse as more pages index. That reads like a ranking collapse and usually isn’t. Average position averages over every query where you appeared at all. With only a few pages indexed you show up almost exclusively for narrow queries you happen to match well, and the average flatters you. As more pages index you start surfacing on far more, far deeper queries, most well down the results — more results, lower average, nothing actually demoted. The tell is whether impressions rose at the same time. A real demotion drags impressions down with the position, not up.

Google won’t tell you what was searched. Below an anonymization threshold it withholds the query strings entirely, because at low volume the exact search could identify the searcher. So early on you may see that something was clicked, on which page, from which country — and never learn what was typed. Worth knowing so you don’t hunt for a report that structurally cannot exist yet. Query data arrives when volume does. Similarly, treat analytics geography with suspicion at low volume: a fair amount of it is crawlers rather than readers.

What went fast

What needed patience

The whole thing is really one question: is your sitemap accurate? Open Search Console and compare pages discovered against pages published. That’s a five-minute check, not a project — and if the numbers don’t match, you’ve found the reason the one channel that compounds is doing nothing for you. I’d rather have this right on a site that’s two days old than discover it a year and twenty posts from now, which is the version of this story most people end up writing.

← Back to all writing