Astro file-based routing. Each .astro file in pages/ becomes a route.
Rendering: Server-side (SSR) by default. Use export const prerender = true for static pages.
| Route | File | Prerendered |
|---|---|---|
/ | index.astro | ✅ Yes |
/products/[id] | products/[id].astro | ✅ Yes |
/wreath-faq | wreath-faq.astro | ✅ Yes |
Static Page Pattern — Copy from index.astro:
---
export const prerender = true;
import BaseLayout from "../layouts/BaseLayout.astro";
import { getCollection } from "astro:content";
const productEntries = await getCollection("products");
---
<BaseLayout>
<!-- Content -->
</BaseLayout>
Dynamic Route with Static Paths — Copy from products/[id].astro:
---
export const prerender = true;
import BaseLayout from "../../layouts/BaseLayout.astro";
import { getCollection } from "astro:content";
import type { Product } from "../../types";
export async function getStaticPaths() {
const productEntries = await getCollection("products");
return productEntries.map((entry) => ({
params: { id: entry.id },
props: { product: { ...entry.data, id: entry.id } as Product }
}));
}
const { id } = Astro.params;
const { product } = Astro.props;
---
<BaseLayout
title={`${product.name} | Ash Mallows Studio`}
description={product.description}
ogImage={product.ogImage || product.image}
>
<!-- Content -->
</BaseLayout>
SEO Props on BaseLayout — Always pass for product/article pages:
<BaseLayout
title="Page Title | Ash Mallows Studio"
description="Page description for search engines"
ogImage="/images/og/page-image.jpg"
canonicalUrl="https://ashmallowsstudio.com/page-slug"
>
export const prerender = true for static content pagesgetCollection("products")Products are managed via Astro Content Collections:
Schema: src/content.config.ts
Data: src/data/products.json
// Fetching products
import { getCollection } from "astro:content";
const products = await getCollection("products");
All pages should follow this structure:
---
export const prerender = true; // For static pages
import BaseLayout from "../layouts/BaseLayout.astro";
// Other imports...
// Data fetching...
---
<BaseLayout title="..." description="...">
<main>
<!-- Main content -->
</main>
<Footer />
</BaseLayout>
| Purpose | File |
|---|---|
| Base layout | ../layouts/BaseLayout.astro |
| SEO component | ../components/astro/SEO.astro |
| Default SEO data | ../data/seo.ts |
| Content collection config | ../content.config.ts |
# List all page routes
find src/pages -name "*.astro" | sed 's|src/pages||' | sed 's|\.astro$||' | sed 's|/index$|/|'
# Find pages using content collections
rg "getCollection" src/pages
# Find pages with prerendering
rg "prerender.*=.*true" src/pages
# Find dynamic routes
find src/pages -name "\[*\].astro"
.astro file in src/pages/export const prerender = true if static content<BaseLayout> with SEO propsgetStaticPaths()@astrojs/sitemap)bun build && bun preview
Then verify:
<head>