Astro · Routing and content

Generate dynamic pages at build time

getStaticPaths lists the values for a dynamic route in a static site.

---
export function getStaticPaths() {
  return [
    { params: { slug: "first" }, props: { title: "First post" } },
    { params: { slug: "second" }, props: { title: "Second post" } },
  ];
}
const { title } = Astro.props;
---
<h1>{title}</h1>

Official Astro documentation

More routing and content commands

All routing and content commands · Astro cheatsheet

Was this page helpful?