Prompt para construir um site SEO estático com Astro
Prompt copiável para scaffolding de um site estático Astro totalmente otimizado com coleções de conteúdo, sitemap, og-images e TypeScript.
CursorClaude CodeCodexWindsurf AstroTypeScriptTailwind
Dê isso ao seu agente para criar um site estático Astro pronto para produção com coleções de conteúdo, Tailwind v4, meta SEO, sitemap e imagens OG por página — sem que ele invente integrações incompatíveis ou pule tags canônicas.
Prompt Principal
You are scaffolding a new Astro static site. Use Astro 5, TypeScript strict mode,and Tailwind CSS v4 (via @tailwindcss/vite — NOT the legacy @astrojs/tailwind integration).
Requirements:- Initialize with `bun create astro@latest` defaults, then layer in: - A `src/content/blog/` collection with a Zod schema (title, description, pubDate, tags). - A shared `<BaseLayout>` with `<head>` containing: canonical URL, og:title, og:description, og:image (per-page), twitter:card, and the Astro `<ViewTransitions />` component. - `@astrojs/sitemap` integration configured with `customPages` for any dynamic routes. - A `public/robots.txt` that disallows `/api/` and allows everything else. - A `/blog/[slug].astro` dynamic route that renders MDX blog posts. - A `/tags/[tag].astro` route that filters posts by tag. - Tailwind applied globally via `src/styles/global.css` imported in BaseLayout.- All components must be `.astro` — no React unless explicitly asked.- Export a typed `getStaticPaths` for every dynamic route.- Do NOT install `@astrojs/react`, `next`, or any SSR adapter — this is a static build.
Stop after listing all files you plan to create or modify. Wait for my approval before writing any code.Notas de Implementação
- As coleções de conteúdo do Astro 5 usam
defineCollectionemsrc/content.config.ts, não o caminho antigosrc/content/config.ts— confirme que o agente usa a localização correta. - O Tailwind v4 vem como um plugin Vite; o padrão antigo
integrations: [tailwind()]noastro.config.tsestá obsoleto e causará um erro de execução. getStaticPathsdeve retornar objetos{ params, props }; o agente às vezes retorna strings simples.
Mudanças Esperadas nos Arquivos
astro.config.ts (new)src/content.config.ts (new)src/layouts/BaseLayout.astro (new)src/pages/index.astro (new)src/pages/blog/[slug].astro (new)src/pages/tags/[tag].astro (new)src/styles/global.css (new)public/robots.txt (new)package.json (edited)tsconfig.json (edited)Critérios de Aceitação
bun run buildencerra com código 0 e sem erros de tipo.- Cada página de postagem do blog inclui uma URL canônica única e
og:imageno HTML renderizado. /sitemap-index.xmlé gerado e contém todas as URLs dos posts do blog./robots.txtexiste e desabilita/api/.
Comandos de Teste
bun run buildbun run previewcurl -s http://localhost:4321/sitemap-index.xml | grep '<loc>'curl -s http://localhost:4321/robots.txtbun run typecheckErros Comuns da IA
- Instalar o pacote obsoleto
@astrojs/tailwindem vez de@tailwindcss/vite. - Colocar
content.config.tsemsrc/content/config.ts(caminho antigo do Astro 4). - Esquecer de chamar
getCollection('blog')dentro degetStaticPaths— retornando um array vazio. - Adicionar
output: 'server'aoastro.config.ts, o que quebra a exportação estática.
Prompt de Correção
The build failed. Check for these issues in order:1. Tailwind: remove `@astrojs/tailwind` from integrations and add `@tailwindcss/vite` to the `vite.plugins` array in astro.config.ts.2. Content config: the file must be at `src/content.config.ts` (not `src/content/config.ts`).3. `getStaticPaths`: each entry must be `{ params: { slug }, props: { post } }`.Fix only the broken items. Show me the corrected diff.