Once articles and photos were in place, my old site still felt one-dimensional: long-form or nothing. I wanted a place for short observations, a home for the URLs I actually want to keep, and one timeline across everything. So I added three sections, each with its own content shape and its own way of reading.
The setup
- Astro 6, a static site with all content under
src/content/. - Content collections with Zod schemas:
posts,notes,linksand at the timecollections_photos(later retired, see why the photo tree is no content collection). - The goal: no runtime queries and no API routes.
Notes
An article is the wrong shape for a one-paragraph observation. I wanted something between a tweet and a blog post: informal Markdown that still lives on my domain. The schema is minimal:
notes: defineCollection({
schema: z.object({
title: z.string(),
publishDate: z.coerce.date(),
draft: z.boolean().default(false),
}),
}),
The index at /notes shows every note in full instead of linking to a summary. Each note goes through render() at build time, and its Content component is embedded in the list:
const renderedNotes = await Promise.all(
notes.map(async (note) => ({
note,
Content: (await render(note)).Content,
})),
);
The page reads as one continuous scroll. Single pages at /notes/[slug] still exist for linking and sharing.
Links
I already kept interesting URLs in scratch files. The aim was a public, curated log with title, URL, source and tags, without turning it into a database project:
links: defineCollection({
type: "data",
schema: z.object({
title: z.string(),
url: z.string().url(),
date: z.coerce.date(),
description: z.string().optional(),
via: z.string().optional(),
tags: z.array(z.reference("tags")).default([]),
}),
}),
With type: "data" the entries are .json or .yaml files in src/content/links/, with no Markdown body. via records where I found the link. The tags reference the shared tags collection, so the labels match those on articles. The index shows the domain without www.:
function getDomain(url: string) {
try {
return new URL(url).hostname.replace(/^www\./, "");
} catch {
return url;
}
}
A static route at /links/tag/[slug], generated at build time from all referenced tags, handles the tag filters. Adding a link means editing one file.
Archives
With four content types (articles, notes, links, photo collections) the site needed one place that shows everything ever published, newest first. The archive is the one page that belongs to no single collection. It reads all four sources, brings them into one shape and sorts them:
const all = [...posts, ...notes, ...photoSets, ...links].sort(
(a, b) => b.date.valueOf() - a.date.valueOf(),
);
The shape has four fields: title, date, url and type. type drives a coloured label on each row (Article, Note, Photo Collection, Link), so the origin is visible without opening the entry. Then the entries are grouped by year:
const byYear = new Map<number, typeof all>();
for (const entry of all) {
const year = entry.date.getFullYear();
if (!byYear.has(year)) byYear.set(year, []);
byYear.get(year)!.push(entry);
}
const years = [...byYear.keys()].sort((a, b) => b - a);
Each year is its own <section> with a bold separator. The date column shows only day and month, since the heading already gives the year.
What stayed the same
All three pages used the same layout as the articles: BaseLayout for meta and OG tags, Nav and Footer, and a single centred column capped at 680px. No new layout component. The build reads src/content/, validates it against the schemas and writes static HTML.
Takeaways
- A small schema per content shape is cheaper than bending one collection to fit everything.
- A shared
tagscollection beats free-form strings as soon as you want tag pages. - The archive is a view, not a collection. Four common fields were enough.
- Topic
-
- IndieWeb Publishing on your own domain first and connecting personal websites with open standards such as Webmention and Microformats.
- Static Website A website made of finished HTML files that are built once and then served unchanged. No server code, no database.
- Uses
-
- Astro Tool for building websites from content such as Markdown. Ships plain HTML by default and only loads JavaScript where it is needed.
- Mentioned
-
- Why the Photo Tree Is No Content Collection Anymore When my old Astro site went bilingual, the photo tree left the content layer: every photo and node needs both languages in one file.
- Tags