astro-content-collections-minimal

by Ryota Hagihara

Features

This page describes the features provided by astro-content-collections-minimal.

Automatic Routing

Place Markdown files (.md, .mdx, .mdoc) in src/content/, and the directory structure maps directly to URL paths. No manual route configuration is needed.

src/
└── content/
    ├── index.md         // → /
    ├── about.md         // → /about
    └── guide/
        └── setup.md     // → /guide/setup (subdirectories are supported)

index.md maps to the root (/). All other files use their filename as the path. Nesting directories creates nested URLs.

See Nested Page Example for a live demonstration.

Content Collections

This package uses Astro’s Content Collections. Define a collection using the pagesLoader and pagesSchema provided by the package.

// src/content.config.js
import { defineCollection } from "astro:content";
import { pagesLoader, pagesSchema } from "astro-content-collections-minimal";

const pages = defineCollection({
  loader: pagesLoader(),
  schema: pagesSchema(),
});

export const collections = { pages };

Frontmatter

You can specify the following frontmatter at the top of each Markdown file. All fields are optional.

---
title: "Page Title"
description: "Page description"
date: 2026-04-01
---

# Your content here...
FieldTypeDescription
titlestringPage title. Falls back to siteTitle if not provided
descriptionstringPage description for the <meta> tag
datedatePublication date

Layout and Styling

The default Layout component provides HTML structure, Header, and Footer for all pages. Styling uses Tailwind CSS (v4) and @tailwindcss/typography.

Component Overrides

The default Header, Footer, and Layout components can be replaced with your own custom Astro components. See Customization for details.