DEV Community

Cover image for How to make an AI-built website show up on Google (a fixed version of the viral Claude Code prompt)
freewebsite247
freewebsite247

Posted on Fully Autonomous

How to make an AI-built website show up on Google (a fixed version of the viral Claude Code prompt)

A joke prompt went around X in October: twenty one-line SEO orders for a vibe-coded site, ending with "Rank #1 by Friday." The punchline is that the list really is most of the technical checklist. Paste it into Claude Code and the agent will do something with every line.

But a few lines are out of date, some can't be done by a coding agent, and the order matters. Below is the checklist in the order that works, with commands to verify each step and a rewritten prompt.

1. Check what a crawler gets without JavaScript

Run this against the live site, not the dev server:

curl -s https://example.com/services/ | grep -i "<h1"
Enter fullscreen mode Exit fullscreen mode

If the browser shows a heading and curl shows nothing, your content is built in the browser. Googlebot does run JavaScript, so server-side rendering isn't strictly required. But rendering is queued, and not all bots run JavaScript. Static HTML is the safer default, and you don't need a server for it: Astro prerenders every page at build time unless you opt out. For a client-side React or Vue app, add a prerender step or move the marketing pages to a framework that outputs HTML.

Links must be <a href="...">, because Google doesn't follow onClick handlers. And a made-up URL must return a real 404:

curl -s -o /dev/null -w "%{http_code}\n" https://example.com/does-not-exist
Enter fullscreen mode Exit fullscreen mode

A single-page app with a catch-all route often returns 200 here, which Search Console reports as a soft 404.

2. Remove everything that blocks indexing

There are three places a block can hide:

curl -s https://example.com/robots.txt
curl -sI https://example.com/ | grep -i x-robots-tag
grep -rni "noindex" src/ public/ astro.config.*
Enter fullscreen mode Exit fullscreen mode

Remove Disallow: / and any noindex meta tag or X-Robots-Tag header from production pages, including ones set in your host's headers config.

Pages that should stay out of Google (thank-you pages, a client login) get noindex and stay crawlable. A page blocked in robots.txt can't have its noindex read, so it can still show up in results. And set noindex in the HTML the server sends. Google may skip rendering when it sees one, so removing it with JavaScript may never register.

3. Generate a sitemap and point robots.txt at it

In Astro:

npx astro add sitemap
Enter fullscreen mode Exit fullscreen mode
// astro.config.mjs
import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap';

export default defineConfig({
  site: 'https://example.com', // required, or no sitemap is built
  integrations: [sitemap()],
});
Enter fullscreen mode Exit fullscreen mode

The build writes dist/sitemap-index.xml and dist/sitemap-0.xml. One catch: the integration can't list dynamic routes rendered on demand, only prerendered ones.

Then public/robots.txt:

User-agent: *
Disallow:

Sitemap: https://example.com/sitemap-index.xml
Enter fullscreen mode Exit fullscreen mode

Google ignores priority and changefreq and only trusts lastmod when it's accurate, so don't let the agent fake dates.

4. Give every page exactly one URL

Pick https, either www or non-www, and one trailing-slash style (trailingSlash in the Astro config). Every other variant should reach the final URL in one 301:

curl -sIL -o /dev/null -w "%{num_redirects} hops -> %{url_effective}\n" http://www.example.com/services
Enter fullscreen mode Exit fullscreen mode

Google follows up to 10 hops, so a chain won't break indexing, but aim for one. Internal links should point at the final URL and not redirect at all.

For canonicals, add one absolute, self-referencing tag in the <head> of your layout:

---
const canonical = new URL(Astro.url.pathname, Astro.site);
---
<link rel="canonical" href={canonical} />
Enter fullscreen mode Exit fullscreen mode

Google treats a canonical as a strong signal, not an order, so it only works when your redirects, internal links and sitemap all agree with it.

A 404 on a page that's really gone is correct, and Google simply drops it. Fix the internal links pointing at it, and 301 old URLs that have a clear replacement.

5. Do the on-page basics, minus the myths

  • Unique <title> and meta description on every page. Google often writes its own snippet from page content, so the description is a suggestion.
  • One H1 per page helps screen readers, but Google's starter guide says heading order doesn't matter for Search. Don't expect a ranking change.
  • Alt text that describes the image. Decorative images get alt="".
  • No orphans. Every sitemap URL needs at least one internal <a href> pointing to it, because Google finds most new pages through links.
  • Breadcrumbs plus BreadcrumbList JSON-LD. Since January 2025 mobile results show only the domain, but desktop still shows the trail, and the links help crawling either way.

Skip the FAQ schema. Since August 2023 Google shows FAQ rich results only for well-known government and health sites. Keep the questions and answers on the page as plain content.

6. Hit the Core Web Vitals numbers

"Under 2 seconds" isn't a metric Google uses. The Core Web Vitals targets are LCP 2.5 s or less, INP 200 ms or less, and CLS 0.1 or less, measured at the 75th percentile of real visits.

A new site has no real-visit data, so PageSpeed Insights shows lab results only, with Total Blocking Time standing in for INP.

In Astro, most of the image work is one component:

---
import { Image } from 'astro:assets';
import hero from '../assets/hero.jpg';
---
<Image src={hero} alt="Technician fitting a tankless water heater" priority />
Enter fullscreen mode Exit fullscreen mode

<Image /> outputs WebP by default and sets width and height, so images don't shift the layout. Keep the file in src/, because public/ is copied as-is. priority (Astro 5.10+) turns off lazy loading for the hero, which is usually your LCP element.

7. Submit the site in Search Console yourself

Claude Code can't do this part. Add a Domain property in Search Console, verify it with the DNS TXT record, then submit https://example.com/sitemap-index.xml under Sitemaps.

Use URL Inspection on the homepage and main service pages: "Test live URL", check the rendered HTML, then "Request indexing". There's a quota, and crawling can take a few days to a few weeks. Friday is optimistic.

Add the site to Bing Webmaster Tools too. It can import your Search Console properties.

8. Do the parts an agent shouldn't

Google doesn't penalize text because an AI wrote it. Its guidance targets pages mass-produced without value for users. The fix for AI-sounding copy is specifics only the business knows: prices, service areas, how a job goes.

The author bio has to be a real person. Google calls fabricated creator profiles deception, so never let the agent invent one. Backlinks come from real relationships: suppliers, local organizations, trade associations.

The prompt

Paste this into Claude Code from the repo root and fill in the brackets:

You're working on [site name], a [framework and version] site deployed to [host] at [production URL]. Google isn't indexing it. Audit first, then fix. Don't change prices, business details, reviews or author info.

Preferred URLs: [https + www or non-www], trailing slash [always/never].
Pages that must stay out of Google: [list or "none"].

1. Rendering: build the site and confirm each page's main text, H1 and nav links are in the built HTML without JavaScript, with links as <a href>. List any page that needs JS to show content and propose a prerendered fix.
2. Blocking: find noindex meta tags, X-Robots-Tag headers and robots.txt Disallow rules in the code, build output and host config. Remove them from production pages. Excluded pages get noindex in the server HTML and stay crawlable.
3. Sitemap: generate one containing only canonical, indexable URLs that return 200. Add a Sitemap: line to robots.txt. No fake lastmod dates.
4. URLs: one absolute, self-referencing canonical in <head> on every page, matching my preferred format. Every other variant redirects to the final URL in a single 301. Update internal links that hit redirects or 404s. Unknown URLs must return a real 404 status.
5. On-page: unique title and meta description per page, drafted from that page's content and marked for my review. One H1 per page. Descriptive alt text, alt="" on decorative images. Visible breadcrumbs with BreadcrumbList JSON-LD. List sitemap URLs with no internal links pointing to them and suggest where to link from. No FAQPage schema.
6. Performance: images in WebP or AVIF with width and height set, largest above-the-fold image not lazy-loaded, no layout shifts. Targets on mobile: LCP 2.5s or less, INP 200ms or less, CLS 0.1 or less.
7. Never invent author bios, credentials, reviews or statistics. Leave a TODO where they're missing.

Finish with a table (check, finding, change, file paths), the curl commands I can run on the live site to confirm each fix, and the steps I have to do myself in Search Console.
Enter fullscreen mode Exit fullscreen mode

To check the output, deploy and run the agent's curl commands against the production URL, because the dev server doesn't show you your host's headers or redirects.

Where to start

Run the curl checks from steps 1 and 2 on the live site today. If the HTML is empty or a noindex is there, nothing else on the list matters until that's fixed. After that, sitemap and Search Console, then work down in order.

Based on a post by Suraj Sharma (@suraj_sharma14) on X: https://x.com/suraj_sharma14/status/2106240327569035424, with corrections and extra steps.

Top comments (0)