Skip to content

Build and deploy ​

BlogGPT generates static files. Connecting a Git repository to Vercel for automatic builds and deployments is recommended; you can also publish the output to other hosts that support directory indexes.

Build with pnpm build; the output directory is dist/.

Production address ​

Set site.baseUrl to the complete production address:

  • Domain root: https://blog.example.org/.
  • Subdirectory: https://example.org/blog/.

It determines deployment paths, canonical URLs, RSS, Sitemap and sharing addresses. Rebuild after changing it, and replace example.com in the demo configuration before publishing.

site.localePrefixPolicy determines language prefixes. The default redirect-to-default uses a zero-second meta refresh from unprefixed HTML addresses directly to final default-language pages. Alternatives omit the default-language prefix or require prefixes. See Languages and translations.

Check production output ​

sh
pnpm install
pnpm build
pnpm preview

The build checks types and generates pages, attachments, share covers, Sitemap and Pagefind indexes. Preview home, articles, categories, tags, pages, images, attachments, language switching, search and feeds.

Connect a Git repository and let Vercel build and publish the blog. Vercel supports Astro natively and lets you select the build command and output directory. Later commits can update the site automatically, while preview deployments let you check changes. BlogGPT uses Astro’s static build; keep the repository’s existing Astro configuration. See Astro’s Vercel deployment guide.

Import the repository ​

  1. Push your customized theme source to your own GitHub, GitLab or Bitbucket repository, retaining package.json, pnpm-lock.yaml and pnpm-workspace.yaml.
  2. Create a Vercel project, connect your Git account and import that repository.
  3. Use the repository root containing blog.config.ts and the root package.json, then configure the build below.

Build settings ​

SettingValue
Framework PresetAstro
Root DirectoryRepository root; keep the default
Install Commandpnpm install --frozen-lockfile
Build Commandpnpm build
Output Directorydist
Node.js Version24.x, satisfying the project’s Node.js 22.12+ requirement

Add ENABLE_EXPERIMENTAL_COREPACK=1 to the Production and Preview environment variables so builds use the pnpm version declared by packageManager in the root package.json. See Vercel’s build settings and Corepack documentation.

pnpm build runs the theme’s complete build, including type checks, bundled attachments, share covers and Pagefind search indexes. Vercel publishes the final files from dist.

Domain and first deployment ​

Set site.baseUrl to the production address. To start with the domain assigned by Vercel, use https://your-blog.vercel.app/, replacing your-blog with the actual project domain. For a custom domain, enter its complete address, add it to the Vercel project and configure DNS as instructed.

Save the configuration and push the commit, then click Deploy in Vercel. Once the build finishes, check articles, images, attachments, search, RSS and the 404 page for unknown addresses. When changing domains, update site.baseUrl and redeploy so canonical URLs, feeds and sharing use the new domain.

Preview deployments retain the production address from site.baseUrl. Use preview domains to check pages; canonical URLs, RSS and share links still point to the production site.

Content updates and previews ​

With Git connected, pushing commits to the production branch (usually main) triggers production deployments. Commits to other branches can create preview deployments for reviewing changes before merging. See Vercel’s Git integration for production branch and automatic deployment settings.

After editing blog.config.ts, articles, images or custom files, commit and push your changes. Scheduled articles need another build after their publication date; redeploy in Vercel or connect a scheduled build workflow.

Other static hosts ​

Set the complete dist/ as the hosting directory. Retain _astro/, search indexes, bundle attachments and generated images.

Configure directory indexes so /zh/posts/hello/ serves its index.html. Serve 404.html with a 404 status for unknown addresses. Replace the complete output on updates to remove obsolete pages and indexes.

Later updates ​

Publication states, statistics and search are generated during the build. Rebuild and deploy after changing content or configuration, or when a scheduled publication date arrives. Hosting automation or scheduled builds can handle updates.

BlogGPT · Documentation