toolbox · framework

Astro

The static site generator behind the Library.

Install

npm install astro
npx astro --version

What it is

Astro is a static site generator: it turns files into HTML at build time and ships no JavaScript unless a component asks to run in the browser.

How it works

  • src/pages/ maps files to URLs. index.astro is /, and library/[...slug].astro is a dynamic route.
  • .astro components have a frontmatter block (build-time JavaScript) and a template.
  • Content collections load Markdown from a folder, validate front matter with Zod and give typed entries to getCollection() and render().
  • output: "static" writes plain files to dist/, which is exactly what Pages serves.

In this project

The Library uses Astro with two collections (library, notes) plus toolbox. The shared header and footer are injected in src/layouts/Base.astro, and tags, RSS and the sitemap are generated from the same content.

Gotchas

  • Astro 7 needs Node 22.23 or newer.
  • dist/ is generated. Edit src/, never the output.
  • A page with no frontmatter fence is just a template; anything that reads files must be in the fence.