Astro Pages

Refer to Astro docs on Pages


Overview

Pages define the routes of the site. The project uses static site generation (SSG) for optimal performance and hosting flexibility.

Page Types

Static Pages

Collection Index Pages

Each collection has a top-level index page that lists all its entries:

Dynamic Pages

Each collection follows the same routing pattern:

This applies to all five collections: muses, short_form, long_form, zeitweilig, and authors.

Dynamic Routing

Dynamic routes are generated from content collections defined in content.config.ts using getStaticPaths():

---
import { getCollection } from "astro:content";

export async function getStaticPaths() {
  const posts = await getCollection("short_form");
  return posts.map((post) => ({
    params: { id: post.id },
    props: { post },
  }));
}

const { post } = Astro.props;
---

Most of this boilerplate is handled by the shared helpers in collections.ts - buildDetailPaths() and buildTagPaths().

RSS Feed Generation

Each collection directory generates an RSS feed via collections.ts’s generateRss() helper:

The RSS link icon in the header is conditionally shown by rss.ts based on the current path.

Type Safety

Component Integration

Each page incorporates components and layouts to maintain consistency. Pages typically:

  1. Import needed components and layouts
  2. Fetch data from content collections
  3. Define any page-specific logic in the frontmatter
  4. Render the appropriate layout with relevant content