Blog · seo strategies

How to Build a Local SEO Website With Claude Code and Astro

A practical walkthrough for building a local business website with Claude Code and Astro, including the page map, style guides, local area research, schema, WebP image optimization, and copy-and-paste resource prompts.

How to Build a Local SEO Website With Claude Code and Astro

To build a local SEO website with Claude Code and Astro, do not start by asking AI to make a pretty homepage. Start by mapping the services, locations, keywords, URLs, and page templates the site needs to rank. Most AI website builds fail because they stop at the visual layer. A local business website needs structure underneath: service pages, location pages, unique local research, internal links, schema, fast loading pages, image SEO, and tracking.

This is the difference between an AI website that looks nice in a demo and a website that can actually bring in local leads for business owners, freelancers, and agencies.

Watch Video Tutorial Instead

Why most AI-built local websites do not rank

Most AI website tutorials follow the same pattern: open an AI builder, generate a homepage, make it look modern, and publish it. That might be useful for a portfolio site, but it is not enough for local SEO.

A local business site has a different job. It needs to show Google what the business does, where it does it, which services deserve their own pages, which locations deserve their own pages, and why each page is useful enough to index.

The classic weak structure looks like this:

  • Homepage
  • About page
  • Contact page
  • One services page with every service listed
  • One areas served page with every location listed

That structure can work in very low competition niches, but it gives every service and every location almost no SEO breathing room. If someone searches for slab leak repair in Katy, a generic services page is usually not the best possible answer.

The structure a local SEO website needs

A stronger local SEO website uses a hub-and-spoke structure. The homepage explains the business. The services hub links to dedicated service pages. The service areas hub links to dedicated location pages. In competitive niches, you can later add service plus location pages, but you do not need to start there for every build.

Page typePurposeExample URLSEO role
HomepageExplain the business, location, trust, and main call to action/Brand and core local relevance
Services hubList all services and link to each service page/services/Pass authority into service pages
Service pageTarget one specific service intent/services/slab-leak-repair/Rank for the service keyword
Areas served hubList target suburbs, towns, or service areas/service-areas/Pass authority into location pages
Location pageExplain service relevance in one specific area/service-areas/katy/Rank for city or suburb searches
Service plus location pageTarget a very specific competitive query/service-areas/katy/slab-leak-repair/Use only when competition justifies it

This connects directly to the broader local SEO principle: one page should satisfy one clear search intent. It also overlaps with programmatic SEO, but the goal is not to mass-produce thin city pages. The goal is to use templates intelligently while making the research and content on each page genuinely different.

Step 1: Create the keyword and page map

The first real step is not design. It is research. Before Claude Code builds anything, create a page map that tells it what pages the site needs and which keywords each page should target.

At minimum, collect:

  • Business type
  • Brand name
  • Core services
  • Primary locations or service areas
  • Transactional keywords
  • Estimated search volume
  • Suggested URL slugs
  • Page titles

This is where a tool like DataForSEO, Ahrefs, Semrush, or DataWise can help. The point is not to worship search volume numbers as absolute truth. They are estimates. The point is to avoid building pages around guesses when you can quickly validate whether people search for the service.

If you are using Claude Code, give it a clear site architecture prompt and ask it to output a CSV with columns such as page title, target keyword, search volume, and slug. That CSV becomes the guardrail for the rest of the build. Claude can still help, but it should not get creative with the URL structure halfway through the project.

Resource 1: Site Architecture + Silo Prompt Use this first. It turns the business, services, and locations into a keyword-validated architecture, Mermaid silo map, and build-ready CSV.

View the full copy-and-paste prompt
# Resource 1: Site Architecture + Silo Prompt

**Where to run it:** Claude Code, with the DataForSEO MCP connected.
**What it does:** Turns your business + services + service areas into a keyword-validated
site architecture, a visual silo map (Mermaid), and a build-ready CSV.

---

## How to use
1. Fill in the four inputs in the `<inputs>` block below.
2. Paste the whole prompt into Claude Code.
3. Claude pulls search volume + difficulty from DataForSEO, then outputs the silo map and CSV.
4. Save the CSV. It becomes the source of truth for the Astro build later.

---

## The prompt (copy everything below)

```
You are a local SEO site architect. Build a keyword-validated website architecture for a
local service business, then output a silo map and a CSV the developer will use to generate
pages.

<inputs>
business_type: {business_type}            # e.g. "plumbing company"
brand_name: {brand_name}                  # e.g. "BlueLine Plumbing"
primary_location: {primary_location}      # e.g. "Austin, TX"
service_areas: {service_areas}            # e.g. ["Round Rock", "Cedar Park", "Pflugerville", "Georgetown"]
services: {services}                      # e.g. ["water heater repair", "drain cleaning", "leak detection", "repiping", "emergency plumbing"]
</inputs>

STEP 1 - KEYWORD VALIDATION (DataForSEO)
For every service and for every service-area combination, use the DataForSEO MCP to fetch:
- monthly search volume
- keyword difficulty
Query both the bare service ("water heater repair") and the localized variants
("water heater repair {primary_location}", "water heater repair {each service_area}").
Also classify each keyword's intent as transactional or informational.
If a service has effectively no transactional search demand, flag it but still keep its
service page (it supports entity completeness and internal linking).

STEP 2 - APPLY THE HIERARCHY
Build exactly this structure. Do not invent extra silos.
- Homepage (targets "{business_type} {primary_location}")
- Services hub  (parent)  ->  one dedicated child page per service
- Service Areas hub (parent)  ->  one dedicated child page per service_area
- Standard pages: About, Contact
- Note (do not build): an informational/blog silo is a recommended next step. List 5
  example blog titles at the end, but do not add them to the CSV.

Internal linking rules:
- Every service page links up to the Services hub and across to the 2-3 most relevant area pages.
- Every area page links up to the Service Areas hub and across to every service page.
- The homepage links to both hubs.

STEP 3 - OUTPUT A (Mermaid silo map)
Output a Mermaid `graph TD` diagram showing Homepage -> hubs -> child pages, so the silo is
visible at a glance. Keep labels to page titles.

STEP 4 - OUTPUT B (CSV)
Output a CSV inside a code block with EXACTLY these columns:
page_title,target_keyword,search_volume,difficulty,slug,page_type,parent,intent,purpose,internal_links

Where:
- page_type is one of: homepage | hub | service | area | standard
- parent is the slug of the parent page (blank for homepage)
- slug is lowercase, hyphenated, no leading slash (e.g. services/water-heater-repair)
- internal_links is a pipe-separated list of slugs this page should link to
- purpose is one sentence on what the page is for and who it serves

STEP 5 - SUMMARY
End with: total page count, a transactional-vs-informational split, and the 5 example blog
titles for the future informational silo.
```

---

## Notes
- This resource is industry-agnostic. Swap the `<inputs>` and it works for roofers,
  electricians, med spas, etc.
- The 40-50% area-page content differentiation rule is enforced later, at content
  generation time, using Resource 4. This prompt only sets the structure.
- Keep the CSV column order exact. The Astro content-collection step depends on it.

Step 2: Design the key templates before building every page

Once the structure is clear, design only the templates you need first. For most local businesses, that means:

  • Homepage template
  • Service hub template
  • Individual service page template
  • Service areas hub template
  • Individual location page template

You can use Claude Design, Google Stitch, Figma, Dribbble inspiration, or component libraries like 21st.dev. The tool matters less than the design discipline.

The homepage needs to pass the two-second test: when someone lands on the page, they should know what the business offers and what to do next within two seconds. For local service businesses, being clever usually loses to being clear.

Do not open with something vague like “solutions for all your needs.” Say the trade, the location, and the action: Houston plumbers, call or book online.

For service and location pages, keep the layout consistent but leave room for unique content. You want a scalable template, not a template that forces every page to sound identical.

Resource 2: Website Style-Guide Prompt Run this before design so Claude Design or Claude Code has a real brand direction instead of producing a generic local business template.

View the full copy-and-paste prompt
# Resource 2: Website Style-Guide Prompt

**Where to run it:** Claude (or Claude Design as context).
**What it does:** Produces a complete brand style guide you paste into Claude Design so the
homepage comes out premium and on-brand, not generic AI slop.

---

## How to use
1. Fill the inputs. If you have a Dribbble or competitor reference, describe it or paste a
   screenshot.
2. Run the prompt. Save the output as `style-guide.md`.
3. Paste that style guide into Claude Design before you ask it to build the homepage.

---

## The prompt (copy everything below)

```
You are a senior brand and web designer. Create a production-ready style guide for a local
service business website. The result must read as premium and trustworthy, never templated
or "AI-generated".

<inputs>
business_type: {business_type}
brand_name: {brand_name}
brand_personality: {brand_personality}   # e.g. "established, dependable, modern, not corporate"
primary_color_hint: {primary_color_hint} # optional, e.g. "deep blue" or "leave open"
reference: {reference}                    # optional: describe the Dribbble/competitor look or attach a screenshot
audience: {audience}                      # e.g. "homeowners 30-65 needing fast, trustworthy service"
</inputs>

Produce the style guide with these sections:

1. BRAND ESSENCE
   - One-line positioning and 3 adjectives that govern every visual choice.

2. COLOR PALETTE
   - Primary, secondary, accent, plus neutral scale (background, surface, border, text).
   - Give HEX values and a one-line usage rule for each.
   - Ensure text/background pairs meet WCAG AA contrast. State the ratios.

3. TYPOGRAPHY
   - Heading font + body font (use widely available Google Fonts).
   - Type scale (h1-h6, body, small) in rem, with line-heights and weights.

4. LAYOUT & SPACING
   - Spacing scale, max content width, grid approach, border-radius and shadow tokens.

5. COMPONENT STYLING
   - Buttons (primary/secondary/states), cards, nav, forms, the hero, trust bar, footer.
   - Describe look and behavior in enough detail to rebuild without guessing.

6. IMAGERY DIRECTION
   - The visual treatment for photos and any illustration. (This must align with the image
     style guide from Resource 3.)

7. VOICE & TONE
   - 3 do's and 3 don'ts for headline and body copy, with one rewritten example.

8. ACCESSIBILITY
   - Contrast, focus states, tap target sizes, motion-reduction note.

Output as clean markdown ready to paste into Claude Design as design context.
```

---

## Notes
- Keep the chosen fonts to common Google Fonts so they survive the Astro build.
- Section 6 must stay consistent with Resource 3 so the generated images match the site.

Step 3: Build an image style guide

Most AI-generated websites look inconsistent because the images were generated one at a time with random prompts. One service page looks cinematic. Another looks like a stock photo. Another looks like a weird plastic render. That weakens trust.

Instead, create an image style guide before generating page images. Define:

  • Camera style
  • Lighting
  • Color grading
  • Composition
  • Uniforms or visual details
  • Brand mood
  • Reusable prompt wrapper

Then only change the scene for each service or location. For example, the wrapper stays consistent, but the scene changes from slab leak repair to drain cleaning to water heater installation.

This helps the website feel like one coherent brand instead of a pile of AI images. It also creates an opportunity for image SEO: use descriptive file names, resize images, convert them to WebP, and write alt text that naturally describes the service and location.

Google's image SEO documentation recommends using descriptive filenames and alt text, and serving images in formats and sizes that support fast loading. For this workflow, export the final images as WebP and compress them before upload. A simple option is TinyPNG, which can optimize WebP, PNG, and JPEG files. This matters for rankings, but it also matters for conversion. A fast local page with useful visuals beats a slow page stuffed with giant PNGs.

Resource 3: Image Style-Guide Prompt Use this to create a reusable image wrapper so every hero, service, and area image feels like one coherent brand shoot. After generating the images, save them as WebP and compress them with TinyPNG before adding them to the site.

View the full copy-and-paste prompt
# Resource 3: Image Style-Guide Prompt

**Where to run it:** Claude to generate the style wrapper, then GPT Image or Nano Banana Pro
to generate the actual images.
**What it does:** Builds a reusable "style wrapper" so every image you generate shares the
same camera, lens, lighting, and grade. You only ever change the `{scene}`. This is what
keeps the site's imagery cohesive instead of looking like random AI pictures.

---

## How to use
1. Run Part A once to lock your style wrapper. Save the output.
2. For every image, use Part B: drop your scene into `{scene}`, keep the wrapper untouched,
   paste the full result into GPT Image or Nano Banana Pro.

---

## Part A: Generate the style wrapper (run once)

```
You are a photography art director. Define a single reusable image style for a local service
business brand so every generated image looks shot by the same photographer on the same day.

<inputs>
business_type: {business_type}
brand_personality: {brand_personality}   # match Resource 2
color_palette: {color_palette}           # paste the HEX palette from Resource 2
mood: {mood}                             # e.g. "clean, bright, trustworthy, real"
</inputs>

Output a STYLE WRAPPER as a single reusable block specifying:
- camera body and lens (e.g. "shot on Sony A7IV, 35mm prime")
- focal length, aperture, depth of field
- lighting setup (natural/soft/studio, direction, time of day)
- color grade and white balance, tied to the brand palette
- composition rules (framing, headroom, rule of thirds, negative space)
- texture/finish (clean editorial, no HDR, no oversharpening)
- a NEGATIVE list (no text, no logos, no watermarks, no distorted hands, no stocky cheesiness)

Format it so a scene description can be prepended and everything after stays fixed.
```

## Part B: The reusable image prompt template

```
{scene}

--- STYLE (do not change) ---
{paste your locked STYLE WRAPPER from Part A here}
```

Example `{scene}` values for a plumbing site:
- "A professional plumber in clean branded uniform inspecting a modern tankless water heater
  in a bright residential utility room"
- "Close-up of hands using a pipe wrench on a chrome fixture under a kitchen sink, shallow
  depth of field"
- "Exterior of a tidy suburban home at golden hour with a branded service van in the driveway"

---

## Notes
- Generate hero, service, and area imagery all through the same wrapper so the gallery feels
  like one shoot.
- Resize every final image to web spec before use (see the build step). Keep heroes optimized
  for fast LCP.
- The negative list is what removes the "AI slop" tells. Keep it strict.

Step 4: Research each location page properly

Location pages are where most local SEO builds go wrong. The lazy version swaps the city name and keeps 90% of the copy the same. That is how you create pages Google does not want to index.

A better location page should include details that would not apply identically to every other location. For a plumbing company, that might include:

  • Local housing stock
  • Common pipe materials in the area
  • Soil conditions
  • Weather risks
  • Local water issues
  • Older neighborhoods versus newer developments
  • Relevant codes or municipal details
  • Nearby landmarks or service boundaries

In the video example, the Katy, Texas page becomes stronger because it talks about real local factors like expansive clay soil, seasonal movement, hard freeze history, slab stress, and housing stock. That is much more useful than repeating “we proudly serve Katy” ten different ways.

If you want a practical audit sheet for this part, use the local SEO area page checklist. Open it, make a copy, and use it to check whether each area page has enough local proof, differentiation, internal links, and conversion elements.

Here is a practical location page checklist:

ElementWhy it mattersBad versionBetter version
H1Confirms the trade and cityServices in your areaPlumber in Katy, Texas
Above-the-fold CTATurns traffic into leadsLearn moreCall now or book online
Local proofShows real relevanceWe know the areaMentions soil, housing, water, weather, or local conditions
Services listConnects location intent to service intentGeneric listInternal links to relevant service pages
Map or boundaryClarifies service areaNo geographic contextEmbedded map or clear neighborhood coverage
FAQAnswers local objectionsSame FAQ everywhereQuestions specific to that location and service

This is also where you should be careful with source links. If you cite a local fact, link naturally inside the sentence instead of dumping a “sources” section at the bottom of a transactional page. You want the page to feel trustworthy without turning it into a research report that distracts from the lead.

Resource 4: Local-Area Research Prompt Run this once per service area. It gives the location page real local texture, which is what helps avoid thin city pages with swapped place names.

View the full copy-and-paste prompt
# Resource 4: Local-Area Research Prompt

**Where to run it:** Claude Code or Claude with web access.
**What it does:** Produces a genuinely different research brief for each service area, so your
area pages carry real local specifics (housing, piping, common issues) instead of reworded
boilerplate. This is what makes the 40-50% content-differentiation rule real.

---

## How to use
1. Run this once per service area. Change only `{specific_area}` each time.
2. Save each brief as `research/{area-slug}.md`.
3. Feed the matching brief into the area-page content generation during the build.

---

## The prompt (copy everything below)

```
You are a local market researcher for a {business_type}. Research the specifics of one
service area so the website's page for it can speak with genuine local authority. Use real,
verifiable details. If you are unsure of a fact, say so rather than inventing it.

<inputs>
business_type: {business_type}            # e.g. "plumbing company"
specific_area: {specific_area}            # e.g. "Pflugerville, TX"
</inputs>

Research and output these sections:

1. HOUSING STOCK
   - Dominant home eras and styles, typical age, common construction types.
   - Approximate share of older vs newer builds.

2. SYSTEMS & MATERIALS (tie to {business_type})
   - For plumbing: piping materials common to the era/area (e.g. cast iron, galvanized,
     polybutylene, copper, PEX), slab vs basement, water heater types.
   - Generalize this section to the relevant systems for other industries.

3. LOCAL CONDITIONS
   - Water hardness/quality, soil type and movement, freeze risk, drought/heat, flood zones.
   - Anything in the local environment that drives service demand.

4. COMMON PROBLEMS
   - The 5-7 issues most likely in this area, each tied to a cause from sections 1-3.

5. LOCAL TEXTURE
   - Real neighborhoods/subdivisions, landmarks, and any relevant local codes or permits.

6. CONTENT ANGLES
   - 5 specific, area-true talking points the page should make that would NOT apply
     identically to a neighboring town. These are what create the 40-50% differentiation.

Keep it factual and specific. Flag any claim you could not verify.
```

---

## Notes
- The value is in section 6: it forces each area page to say something locally true and
  distinct, which is both better for users and what separates this from spun content.
- Run it fresh per area. Do not reuse one area's brief for another.

Step 5: Build the first pages in Astro with Claude Code

Astro is a strong fit for local SEO websites because it is fast, content-friendly, and works well with Cloudflare Pages. Claude Code can scaffold the project, create reusable components, and turn your page map into templates.

Do not ask it to build every page at once on the first run. Start with:

  • Homepage
  • Services hub
  • One service page
  • Service areas hub
  • One location page

Then run the site locally and inspect those pages. Fix the template before scaling it. This is boring, but it prevents the classic AI build problem where you generate 80 pages and then realize the mobile hero layout is broken on every one of them.

When you are happy with the first service page and first location page, then ask Claude Code to apply the same structure to the remaining services and locations from your CSV.

Step 6: Check mobile, speed, and technical SEO before launch

Before sending the site live, test it like a real local customer would. Open it on mobile. Check the hero section. Click the phone number. Try the form. Look at the service pages. Make sure the location pages do not feel like duplicates.

Then check the technical SEO basics:

  • Title tag includes the service or location keyword
  • Meta description is specific and has a call to action
  • Only one H1 per page
  • Headings follow a logical structure
  • Internal links connect hubs, services, and locations
  • Images are WebP, compressed with a tool like TinyPNG, and have descriptive alt text
  • Pages load quickly
  • Schema is valid
  • Sitemap is generated
  • Google Analytics and Search Console are installed

Google's structured data documentation includes LocalBusiness and service-related markup that can help clarify what the business is. Schema alone will not rank a weak page, but it makes the site easier for search engines and AI systems to understand.

Resource 5: Schema Identifier Prompt Use this after the CSV is ready. It maps each page type to the right structured data and outputs JSON-LD blocks you can add to the Astro build.

View the full copy-and-paste prompt
# Resource 5: Schema Identifier Prompt

**Where to run it:** Claude Code, with the CSV from Resource 1.
**What it does:** Tells you exactly which schema (structured data) each page needs and outputs
ready-to-use JSON-LD. Pair it with `schema-checklist.md` as the reference.

---

## How to use
1. Have your Resource 1 CSV ready.
2. Paste the prompt below into Claude Code and attach/point it at the CSV.
3. Claude returns a per-page schema plan plus JSON-LD blocks to drop into the Astro build.

---

## The prompt (copy everything below)

```
You are a structured-data specialist. For each page in the attached site architecture CSV,
determine the required schema and output valid JSON-LD.

<inputs>
business_type: {business_type}            # e.g. "plumbing company"  -> use the matching schema.org type (e.g. Plumber)
brand_name: {brand_name}
nap: {nap}                                # name, address, phone (must be identical everywhere)
csv: {attach the Resource 1 CSV}
</inputs>

RULES (page_type -> schema):
- homepage: LocalBusiness (use the most specific type, e.g. Plumber) + WebSite + BreadcrumbList
- hub:      CollectionPage + BreadcrumbList
- service: Service (with provider, areaServed, serviceType) + BreadcrumbList + FAQPage if the page has FAQs
- area:     LocalBusiness or Service with areaServed set to that area + BreadcrumbList
- standard (Contact): ContactPage / Organization as appropriate + BreadcrumbList
- standard (About):   AboutPage + BreadcrumbList

REQUIREMENTS:
- NAP must be byte-identical across every block (matches the GBP exactly).
- Set sameAs to the brand's real profiles if provided.
- Do not fabricate aggregateRating or reviews. Only include them if real review data is given.
- Use absolute URLs based on the page slugs.

OUTPUT:
For each page output: page_title, slug, the list of schema types, and a complete JSON-LD
<script type="application/ld+json"> block ready to paste into the page head.
End with a validation reminder to run every page through Google's Rich Results Test.
```

---

## Notes
- The "use the most specific type" rule matters: `Plumber` beats generic `LocalBusiness` for
  entity clarity. For other industries, swap to the correct schema.org subtype
  (Electrician, RoofingContractor, HVACBusiness, etc.).
- Never invent ratings. Fake `aggregateRating` is a manual-action risk and breaks trust.

Step 7: Add tracking and connect the Google Business Profile

A local SEO website is not finished when it looks good. You need tracking from the start. Install Google Analytics, verify the Google tag, track form submissions and call clicks, and connect Google Search Console so you can see impressions, queries, and indexing issues.

Then align the website with the Google Business Profile. The services listed on the site should match the services listed in Google Business Profile. The name, address, phone number, categories, service areas, and key offers should not fight each other.

This is one of those simple steps people skip because it is not exciting. It is also one of the steps that makes the whole local SEO system easier for Google to trust.

Local SEO website build checklist

Use this checklist before you publish an AI-built local website. You can also view and make a copy of the local SEO area page checklist here.

When should you create service plus location pages?

Not every local website needs a page for every service in every location. If you have 12 services and 20 locations, that could become 240 pages quickly. That is fine only if you have the research, content, and reason to support it.

For most businesses, start with the core structure:

  • One page per service
  • One page per location
  • Strong internal links between them

If a niche is highly competitive, then create service plus location pages for the highest-value combinations. For example, slab leak repair in Katy may deserve its own page if there is meaningful search demand and competition. But do not create hundreds of thin pages just because Claude Code can generate them quickly. That is not strategy. That is a faster way to make a mess.

Watch the video tutorial

If you prefer to see the workflow visually, watch the full tutorial below.

Final take

AI makes it easier than ever to build websites, but that also means the internet is filling up with pretty websites that have no SEO strategy underneath. The advantage now goes to the person who combines AI speed with proper structure, research, and QA.

If you want to build local business websites that actually have a chance to rank, start with the map: services, locations, keywords, templates, local proof, schema, speed, and tracking. Claude Code and Astro can build the site fast, but the SEO structure is what gives the build a reason to exist.

If you want the prompts, checklists, and step-by-step workflows for building SEO websites with AI, join the free AI Ranking community and start with the AI Search Kickstarter.

Sources and further reading

Join the community