Deploying and Updating Your Blog

Your Name2 min read4 chapters

Chapter builds to plain static files, so it runs on any static host. This post covers the settings that matter, the common hosts, and how to update the theme later.

Before the first deploy

Set your domain in src/config/site.ts:

src/config/site.ts
export const SITE_CONFIG = {
url: 'https://blog.example.com',
// ...
} as const;

The sitemap, RSS feed, canonical links, social cards and robots.txt all use it. Leaving https://example.com in place is the most common deploy mistake.

Then build once locally to catch problems early:

Terminal window
$ pnpm build
$ pnpm preview

pnpm build also type-checks the project, so a broken frontmatter field fails here rather than in production.

Vercel, Netlify and Cloudflare Pages

Connect the repository and use these settings. All three detect Astro and usually fill them in for you:

Setting Value
Build command pnpm build
Output directory dist
Node.js version 22.23.4 or later

Every push to the main branch then rebuilds and publishes the site, and pull requests get preview URLs.

GitHub Pages

Add a workflow that builds the site and publishes dist/. Astro maintains an official action:

.github/workflows/deploy.yml
name: Deploy
on:
push:
branches: [main]
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: withastro/action@v6
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
steps:
- uses: actions/deploy-pages@v5

In the repository settings, set Pages → Source to GitHub Actions.

Chapter expects to be served from the root of a domain. On GitHub Pages that means a user or organisation site (https://you.github.io/) or a project site with a custom domain. A project site at https://you.github.io/blog/ is not supported yet.

Updating the theme

Your blog started as a copy of the theme, so new versions are not applied automatically. Add the theme as a second remote and merge it:

Terminal window
git remote add theme https://github.com/AndyWang505/astro-theme-chapter.git
git fetch theme
git merge theme/main --allow-unrelated-histories

Conflicts usually appear in src/config/ and src/content/, where your own changes are. Keep your side for content and settings, and the theme’s side for components and styles. Run pnpm test && pnpm build before pushing.

Each release lists its changes on the releases page, so you can read what changed before merging.