Build and Deploy
BlogGPT compiles your site into static HTML, CSS, and JavaScript inside the dist/ directory. You can host it on any static platform—including Vercel, Netlify, Cloudflare Pages, or GitHub Pages—without needing a Node.js runtime in production.
One-Click Deployment (Starter)
If you haven't cloned the repo yet, you can create and deploy a new blog directly from the BlogGPT Starter Template:
- Vercel: Click the Deploy with Vercel button on the starter README. Vercel automatically detects Astro (
pnpm buildand output directorydist). - Netlify: Click the Deploy to Netlify button on the starter README. The included
netlify.tomlpre-configures the build settings.
Production URL
Before deploying to production, set your canonical domain so that RSS feeds, Sitemaps, canonical links, and Open Graph cover URLs resolve properly.
You can set this in blog.config.ts:
export default {
site: {
baseUrl: 'https://blog.example.com',
// ...
},
};With the default starter configuration, you can also set SITE_URL in your hosting dashboard, for example SITE_URL=https://blog.example.com. The starter reads it first, then falls back to the Vercel production domain or Netlify site URL. Set SITE_URL and rebuild after adding a custom domain. The main theme repository does not read this variable; edit site.baseUrl directly when using that repository or a fixed URL in your configuration.
Subpath deployments: Addresses such as
https://example.com/blog/are supported. Setsite.baseUrlto the complete URL, including the deployment directory, so routes and asset paths use the correct base.
Build Check
Always run a local build check before pushing to production to catch invalid frontmatter and broken resource references:
pnpm build
pnpm previewVerify that:
pnpm buildexits with code0and generates the Pagefind search index.- Draft posts (
draft: true) are excluded from the production output. - Search, RSS (
/zh/rss.xmlwith the default configuration; adjust for your language prefix policy), and Sitemap (/sitemap-index.xml) work as expected inpnpm preview.
Manual Deployment & GitHub Pages
Standard Static Hosting (Cloudflare Pages, Nginx, S3, etc.)
- Install Command:
pnpm install - Build Command:
pnpm build - Output Directory:
dist - Node.js Version:
24.xfor the starter; the main repository also supports22.12.0or newer
GitHub Pages
To deploy via GitHub Actions:
- In your GitHub repository, go to Settings → Pages and set Build and deployment → Source to GitHub Actions.
- Set
site.baseUrlto the public URL:https://<username>.github.io/for a user site, or a URL including the repository directory, such ashttps://<username>.github.io/my-blog/, for a project site. - Add an Astro GitHub Pages workflow under
.github/workflows/deploy.ymlusing Node.js 24 and the pnpm version pinned in the repository.