Generating Routes from Content
Content collections are stored outside of the src/pages/ directory. This means that no routes are generated for your collection items by default. You will need to manually create a new dynamic route to generate HTML pages from your collection entries. Your dynamic route will map the incoming request param (ex: Astro.params.slug in src/pages/blog/[…slug].astro) to fetch the correct entry inside a collection.
The exact method for generating routes will depend on your build output mode: ‘static’ (the default) or ‘server’ (for SSR).
Building for static output (default)
If you are building a static website (Astro’s default behavior), you would use the getStaticPaths() function to create multiple pages from a single src/pages/ component during your build.
Call getCollection() inside of getStaticPaths() to query your content. Then, create your new URL paths using the slug property of each content entry.