src/pages/

Responsibility

Implements the file-based routing layer for the Astro 6 static site. Each .astro file or subdirectory maps to a URL path segment, producing fully static HTML at build time via getStaticPaths for dynamic routes and direct rendering for static ones. trailingSlash: "always" is enforced at the framework level.

Design

Routes are grouped by feature into subdirectories, each containing index.astro for the listing page and, where applicable, [slug].astro for detail pages. Three content-driven dynamic routes use getStaticPaths to pre-render all entries from content collections. One API endpoint (robots.txt.ts) returns a plain-text response.

Route inventory (15 files, 16 routes):

Route pathFileType
/src/pages/index.astroStatic
/produktionen/src/pages/produktionen/index.astroStatic
/produktionen/[slug]/src/pages/produktionen/[slug].astroDynamic (productions collection)
/news/src/pages/news/index.astroStatic
/news/[slug]/src/pages/news/[slug].astroDynamic (news collection)
/news/abo/src/pages/news/abo/index.astroStatic
/anfahrt/src/pages/anfahrt/index.astroStatic
/impressum/src/pages/impressum/index.astroStatic
/datenschutz/src/pages/datenschutz/index.astroStatic
/faq/src/pages/faq/index.astroStatic
/tickets/src/pages/tickets/index.astroStatic
/mieten/src/pages/mieten/index.astroStatic
/mitwirkende/[slug]/src/pages/mitwirkende/[slug].astroDynamic (people collection)
/aboutus/src/pages/aboutus/index.astroStatic
/not-found/src/pages/not-found/index.astroStatic (custom 404 page)
/robots.txtsrc/pages/robots.txt.tsAPI route (text/plain)

Dynamic route patterns:

Flow

  1. Static pages — Astro reads the .astro file frontmatter at build time, executes the script block (importing layouts, components, and inline data), and renders the template to a static HTML file at the corresponding directory path (e.g., /produktionen/index.html → served at /produktionen/).
  2. Dynamic pagesgetStaticPaths is invoked at build time. It queries content collections via getCollection() / getPublishedNewsEntries(), maps each entry to { params: { slug }, props }, and Astro generates one HTML file per entry. The page script receives Astro.props, renders the MDX Content via await render(entry), and wraps it in a layout.
  3. API routerobots.txt.ts exports a GET function that returns a Response with Content-Type: text/plain, dynamically inserting the sitemap URL from the site config.
  4. Layout hierarchy — All routes wrap in BaseLayout (provides HTML shell, SEO meta, JSON-LD, Google Fonts, analytics bootstrap, and dark-mode safeguard). Production detail routes additionally inject ProductionsLayout as an MDX wrapper component; contributor detail routes inject PeopleLayout. Legal-content pages (impressum, datenschutz) use ContentPageShell for prose spacing.
  5. React islands — Two pages hydrate client-side React components:

Integration

All routes depend on BaseLayout (@/layouts/BaseLayout.astro) for the outer HTML document. Feature-specific layouts/components are imported per route as shown below.

Route pathLayoutsFeature components / MDXContent collectionsNotable imports
/BaseLayoutHomeHeroSection, HomeNewsSection, HomeUpcomingShowsSection, AboutUsPromo, HomePressReviewSectionbuildOrganizationJsonLd
/produktionen/BaseLayoutproductions (filtered: !hidden)getProductionDates, normalizeUrl
/produktionen/[slug]/BaseLayout, ProductionsLayout (MDX)Renders production MDXproductions, peoplebuildPeopleById, buildBreadcrumbJsonLd, buildProductionEventJsonLd, summarizeForMeta
/news/BaseLayoutnews (via getPublishedNewsEntries)buildNewsImage, formatNewsDate, normalizeUrl
/news/[slug]/BaseLayoutNewsImage, NewsSeparator, NewsSplitLayout, NewsText, NewsMaxWidth, NewsButtonLink, ButtonGroup, RichTextContentnews (via getPublishedNewsEntries)buildBreadcrumbJsonLd, summarizeForMeta, formatNewsDate
/news/abo/BaseLayoutNewsletterFormBlock (React, client:load), Toaster (React, client:idle)sonner/dist/styles.css
/anfahrt/BaseLayout, ContentPageShellbuildResponsiveImage (gittertor.jpg)
/impressum/BaseLayout, ContentPageShellanimatedProseTextLinkClassName
/datenschutz/BaseLayout, ContentPageShellanimatedProseTextLinkClassName
/faq/BaseLayoutFaqContent (MDX from @/features/pages/faq/)
/tickets/BaseLayout (overridden classes)TicketShopIframe (React, client:load)
/mieten/BaseLayout, ContentPageShellImageTextSection, RichTextContentbuildResponsiveImage (4 images from assets)
/mitwirkende/[slug]/BaseLayout, PeopleLayout (MDX)Renders person MDXpeople, productionsbuildParticipationsByPerson, buildPeopleLayoutContext
/aboutus/BaseLayout, ContentPageShell
/not-found/BaseLayoutnormalizeUrl
/robots.txt— (API route)APIRoute type

Content collections (defined in src/content.config.ts):