Getting Started with Chapter

Your Name2 min read4 chapters
Getting Started with Chapter cover

Chapter is an Astro theme for long-form technical writing. This series walks through it from an empty folder to a published site. Every ## heading in a post becomes a numbered chapter in the table of contents on the right; this post has four.

Create the project

You need Node.js 22.23.4 or later. Create a project from the template:

Terminal window
npm create astro@latest -- --template AndyWang505/astro-theme-chapter

Or with pnpm:

Terminal window
pnpm create astro@latest --template AndyWang505/astro-theme-chapter

You can also open the repository on GitHub and press Use this template.

Run it locally

Terminal window
$ cd my-blog
$ pnpm install
$ pnpm dev
astro v7.4.13 ready in 812 ms
Local http://localhost:4321/

Open the address in a browser. Pages reload as you edit files.

Add your first post

Posts are Markdown files in src/content/blog/. The file name becomes the URL, so hello-world.md is served at /post/hello-world/.

src/content/blog/hello-world.md
---
title: 'Hello, world'
description: 'One or two sentences shown in lists and link previews.'
pubDate: 'December 1 2026'
tags: ['Markdown']
category: 'Writing'
---
The first paragraph is the lead.
## First chapter
Text.

Every post needs a category and one to three tags. Both must be listed in src/config/site.ts; a test checks this so typos do not create one-off tags. The next post covers that file.

Build and deploy

Terminal window
pnpm build

The site is written to dist/ as static files. Upload it to any static host, or connect the repository to Vercel, Netlify or Cloudflare Pages and set the build command to pnpm build.