A local-services page needs to get two things right: what the business offers in that city and what the page tells the visitor. Reusing a template helps with layout, but it does not answer either question on its own.
In this Astro project, a Barcelona flooring page can be enabled while a painting page stays disabled. The relevant content can remain in the project without being published. I kept availability, longer page copy and shared layout in separate inputs, then used them together when assembling each page.
The same approach applies to FAQs. The questions a visitor reads and the questions described to search engines come from one selection, so the two versions stay consistent.
Barcelona can offer one service without publishing another
JSON records describe cities and services. Markdown holds the longer content for city pages, service pages and city-service pages. Shared Astro templates put those inputs together.
The route builder checks three settings: the city is active, the service is active, and that city allows the service. All three must agree before the page is generated.
The retained configuration makes the difference concrete:
| Combination | City active | Service active | City allows service | Route generated |
|---|---|---|---|---|
| Barcelona + laminate installation | Yes | Yes | Yes | Yes |
| Barcelona + home painting | Yes | No | Yes | No |
Barcelona and its local painting flag are enabled, but painting is globally inactive. The painting route is therefore excluded. There is no need to delete its content to stop publishing it.
For an enabled combination, the template finds the Markdown entry with matching city and service slugs, the identifiers used in URLs. That record supplies the text and metadata, with template fallbacks where content is absent.
The content collections require fields such as title, description and hero text through Zod schemas. A missing required field can be caught when the content is processed. That is a structural check; it cannot decide whether the wording is helpful or accurate.
The project contains 83 Markdown records: 66 city-service entries, 11 city entries and six service entries. These are stored-content counts. The active settings determine which routes are generated.
Replace the repeated questions with a relevant selection
The project notes describe the earlier FAQ implementation as five repeated questions with city and service names substituted. The current pool has 78 questions across ten categories, including service-specific and general questions.
For example, “¿Qué grosor de suelo laminado debo elegir para mi vivienda?” asks what thickness of laminate flooring to choose for a home. Its service association connects it to flooring. Changing a city name inside a generic question would not make that question relevant to every service.
The city-service selector asks for five questions. It takes up to three that match the service, then fills remaining places from the general questions. The city and service identifiers provide a repeatable shuffle seed, so rebuilding unchanged inputs keeps the same order.
const pageFAQs = getPageFAQs(service.slug, city.slug, 5);I pass that array to both the visible FAQ section and generateFAQSchema(). The latter creates JSON-LD, the machine-readable description of those questions and answers.
Select the questions once
FAQSectionVisible questionsRender the selected questions and answers.
generateFAQSchema(pageFAQs)JSON-LDDescribe those same questions in structured data.
Selecting once keeps a visitor's page and its structured data aligned. Editing an answer in the pool updates both through the shared input.
The result is an implemented content system with explicit route availability and repeatable FAQ assembly. It does not guarantee unique wording on every page, and a small eligible pool can return fewer than five questions. Search performance and the quality of the answers still need their own evidence.
Project sources & checks
astro-seo-website: src/content/config.ts, src/utils/faq-utils.ts, src/data/faqs.json and src/pages/[city]/[service].astro.
Counted 66 city-service, 11 city and 6 service Markdown records; FAQ data contains 78 questions across 10 categories.
Configured content counts are not published-page counts. Routes filter active cities, active services and city-level availability; no traffic uplift is claimed.