← Stacks

Astro Static Site

Platform: web | typescript

name: Astro Static Site
platform: web
language: typescript
framework: astro@6
styling: [email protected]
package_manager: pnpm
auth: "none (static site, auth via external service if needed)"
architecture: islands_architecture
i18n: "@astrojs/i18n or paraglide-js"
linter: eslint (flat config v9, eslint-plugin-astro, typescript-eslint)
formatter: prettier (prettier-plugin-astro)
type_checker: tsc --noEmit (strict mode)
testing: vitest
pre_commit: husky + lint-staged (eslint + prettier + tsc)
key_packages:
  - astro
  - "@astrojs/cloudflare"
  - tailwindcss
  - eslint + eslint-plugin-astro + prettier (code quality)
deploy: cloudflare_pages
infra: sst (sst.config.ts) — Tier 1
ci_cd: github_actions
monitoring: superduper-analytics (cookieless sda.js counter, one tag in <head>, https://github.com/fortunto2/superduper-analytics) + cloudflare_analytics
errors: nothing collected in the browser by design, no third-party error SDK; build output + Pages logs below
logs:
  cf_pages: "wrangler pages deployment tail --project-name={name}"
  local_build: "pnpm build 2>&1 | tail -50"
dev_server:
  command: "pnpm dev"
  port: 4321
  ready_url: "http://localhost:4321"
visual_testing:
  type: browser
  checks:
    - "Navigate to localhost:4321, verify page loads without console errors"
    - "Check that content collections render correctly"
    - "Verify responsive layout at mobile viewport (375px)"
features:
  - content_collections
  - static_generation
  - islands_architecture
agent_readiness:
  # Proven on two production Astro sites on Cloudflare Pages (agent audit 9-11/12, SEO+GEO 30/30).
  # Most of their traffic arrives from assistants citing them, so this is the distribution layer.
  check: "seo agent-audit https://{domain} && seo audit https://{domain}/"
  markdown_twins: "Build a Markdown twin per page from the same data as the HTML, at the page path + .md. functions/_middleware.ts serves it for Accept: text/markdown (exact type, not */*); the home page answers with llms.txt. X-Robots-Tag: noindex on /*.md so twins never compete with the pages they mirror. Cloudflare's dashboard Markdown for Agents is the zero-code fallback, with less control."
  llms_txt: "llms.txt (title, URL and description per page, plus how to connect and how to ask) and llms-full.txt (every page in full), generated from content collections"
  robots: "Name the AI bots (GPTBot, ClaudeBot, PerplexityBot, Google-Extended, ...) and add Content-Signal: search=yes, ai-input=yes, ai-train=no"
  link_headers: "public/_headers on /*: Link to llms.txt (rel=describedby), llms-full.txt, sitemap, /.well-known/api-catalog (rel=api-catalog), the agent-skills index and the MCP card (rel=service-desc)"
  well_known: "/.well-known/api-catalog (RFC 9727, application/linkset+json), /.well-known/agent-skills/index.json (discovery v0.2.0, sha256 per skill) when there are skills, /.well-known/mcp/server-card.json when there is an MCP server; Access-Control-Allow-Origin: * on /.well-known/*"
  mcp_server: "functions/mcp.ts on Pages: stateless Streamable HTTP, POST-only, answers application/json, no auth. Tools only over what the site already publishes (a build-time search index, the twins, its JSON). read refuses other hosts and treats an HTML response as not found. A tool never acts for a person: return a link they open and submit themselves."
  webmcp: "Optional: toolname and tooldescription on a <form> (Chrome declarative WebMCP, spread as attributes since Astro's types lack them); no toolautosubmit on a form that carries personal data"
  structured_data: "JSON-LD with dateModified from the real content or check date, never the build date; Article/BlogPosting on articles, Blog on a blog home, Product on anything with an Offer; potentialAction (e.g. AskAction with a urlTemplate) for what an agent can do on the page"
  sitemap: "lastmod only from a real date (updated, created or checked), never the build date. /sitemap.xml must resolve: with @astrojs/sitemap add a 301 to /sitemap-index.xml in public/_redirects."
  internal_links: "Use the trailing slash the pages are served at (canonical and sitemap). A slash-less href costs every click and crawl a 308, and audits count it as broken; add it in markdown rendering and wikilinks too."
  og_images: "Per-page Open Graph PNGs generated at build (resvg); resvg mis-shapes Devanagari with every font tried, so fall back to Latin text there"
  dates: "Format ISO dates with timeZone: 'UTC'; formatted in the build machine's zone they show the day before"
  email: "Wrap mailto: links and plain-text addresses in <!--email_off--> markers (via set:html): Cloudflare Email Obfuscation turns both into a /cdn-cgi link that 404s for agents and crawlers"
  contact: "If people should be able to reach you, let agents do it for them: the booking link and address in llms.txt, a ContactPoint (email, booking url, languages) on the site's Person in JSON-LD, and an MCP contact tool returning the booking link plus a ready mailto drafted from the topic, in the topic's language. It books and sends nothing; the person, or their own agent with their own calendar and mailbox, does."
  leads: "For a site that collects requests, the same rule: agents get a link that opens the form or chat with the question typed in (?ask=...#form, tagged utm_medium=agent and a campaign per channel), never an endpoint that submits for someone. A request carries a contact and consent."
  deploy: "Run wrangler pages deploy from the directory that holds functions/; deployed from anywhere else, the Functions are silently dropped"
notes: |
  - pnpm as package manager
  - ESLint flat config + eslint-plugin-astro for .astro files
  - Prettier with prettier-plugin-astro for formatting
  - tsc --noEmit for type-checking (strict mode)
  - Vitest for unit tests
  - Husky + lint-staged for pre-commit (eslint, prettier, tsc --noEmit)
  - i18n via @astrojs/i18n or paraglide-js
  - English first, then localize
  - Content collections for structured content
  - Agent-readable from day one: see agent_readiness (twins, llms.txt, discovery files, MCP)
  - Content stored as markdown first, HTML generated from it (not reverse)
Sources

Related