getStaticPaths missing on dynamic Astro route
What this means
Section titled “What this means”Astro is a static site generator by default. A file like src/pages/blog/[slug].astro signals a dynamic route, but without getStaticPaths() Astro has no list of URLs to build. The route does not appear in the output at all.
How to fix it
Section titled “How to fix it”Export getStaticPaths() from the component frontmatter. It returns an array of { params, props } objects — one per page.
---export async function getStaticPaths() { const posts = await getPosts() return posts.map(post => ({ params: { slug: post.slug }, props: { post }, }))}
const { post } = Astro.props---
<html lang="en"> <head> <title>{post.title}</title> <meta name="description" content={post.excerpt} /> </head> <body> <h1>{post.title}</h1> <p>{post.excerpt}</p> </body></html>If the content is truly dynamic — real-time data, user-generated content — switch to server-side rendering instead.
import { defineConfig } from 'astro/config'import node from '@astrojs/node'
export default defineConfig({ output: 'server', adapter: node({ mode: 'standalone' }),})With output: 'server', dynamic routes are rendered on request and getStaticPaths() is not required.
Verify the fix
Section titled “Verify the fix”Run npx astro build and confirm the output directory contains the expected HTML files for each path. Then re-run orino audit.