Deployment
This page explains the blog’s release & deployment: how static output is hosted, the Vercel production deployment and test-domain flow, the four Docker build modes, and the “code change vs content change” release choice. The deployment chain relies on git submodules (themes/matery/ etc.), so commits need both repos committed together (see section 6).
How to read: every deployment target is given as a pair — Effect (which domain/repo gets updated) → Corresponding command/config → Output. Config sections still follow “How to enable → Common options → All tunable keys → Boundaries & conflicts”.
1. Deploying Static Output (any static host)
Purpose: Hexo generates pure static files; the
public/directory can be dropped on any static host (Nginx, GitHub Pages, Cloudflare Pages, OSS etc.) and go live directly.Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts
1.1 How to enable
Effect: public/ contains the complete site (index.html + page directories + static assets); sync it to any web server root and visiting that domain shows your blog.
Corresponding command:
npm run build # hexo generate + pagefind index; output in public/
npm run clean # hexo clean; clears public/ and cacheOutput: public/index.html, public/posts/, public/pagefind/ etc. are generated; npm run build exiting with code 0 means the build succeeded.
1.2 Common options
① Deploying means syncing public/
Effect: copy it to the web server root and it’s live; where the domain points is decided by the hosting platform (this project uses Vercel in production, see §2).
Corresponding command (example; replace the placeholders for your host):
rsync -a --delete public/ {{USER}}@{{HOST}}:{{WEB_ROOT}}/Output: the server directory matches the local public/, and refreshing the domain shows the new pages.
② The root URL must match
Effect: with a correct url, absolute links in canonical, sitemap and RSS all point at your domain; a wrong one leaves those links pointing at the old domain (SEO and share cards go wrong with it).
Corresponding config (root _config.yml):
url: https://blog.17lai.siteOutput: <loc>/<link> in public/sitemap.xml and public/atom.xml use that domain.
1.3 All tunable keys
| Option | Type | Default | Values / range | Purpose |
|---|---|---|---|---|
url | string | — | full site URL | base for absolute canonical/sitemap/RSS links |
public/ | directory | — | any static host root | deployment output |
npm run build | command | — | — | hexo generate + pagefind index |
npm run clean | command | — | — | clears public/ and the Hexo cache |
1.4 Boundaries & conflicts
- Deploying means syncing
public/: copy it to the web server root and you’re done; where the domain points is decided by the hosting platform. - The root URL must match:
urlin_config.ymldecides absolute links in canonical/sitemap/RSS — change it when the hosting domain changes (see the Global Configuration chapter). - This project uses Vercel in production (next section); the old GitHub Pages deployment is retired.
1.5 Summary
- Minimum viable:
npm run build, then syncpublic/ - Changing domain: update
urlin_config.ymlfirst, then build - Local viewing only:
npx hexo server -p 4100
2. Vercel Production Deployment (blog.17lai.site)
Purpose: production at
https://blog.17lai.site. Vercel is linked to the GitHub repogithub.com:appotry/hexo.git(main branch) — pushes trigger automatic builds, no manual trigger needed.Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts
2.1 How to enable
Effect: the main branch of hexo.git gains one commit + one git tag; minutes later https://blog.17lai.site becomes the new version and the ?v= version in the HTML increments (so browsers/PWA fetch the new assets).
Corresponding command:
# push to hexo.git (production repo)
tools/cicd.sh -r "feature description" # build + version bump + git tag + pushOutput:
tools/.VERSIONincrements and the matching git tag is created- Only
hexo.git(production) is pushed;hexoback.gitis untouched - Vercel runs
npm run buildin the cloud and the output goes straight onto the CDN
2.2 Common options
① Verify production after release
Effect: layer-by-layer checks against the production domain — complete build output, 20 layout pages returning HTTP 200, comment sections present, version consistent in three places, SW smoke, etc.; any failing layer errors out.
Corresponding command:
tools/tests/release-test.shOutput: a PASS/FAIL report per layer L1–L14 with a final total; the release only counts as done when everything is green.
② Don’t create an extra deployment repo
Effect: production only trusts hexo.git, and Vercel only watches it; a second repo means two sets of output and a confused domain mapping.
Corresponding config: the Vercel project’s Git integration (in the Vercel console, not repo config).
2.3 All tunable keys
| Deployment target | Trigger | Repo | Resulting domain |
|---|---|---|---|
| Production | tools/cicd.sh -r "feature" | hexo.git (main) | https://blog.17lai.site |
| Test domain | tools/cicd.sh -t "desc" | hexoback.git | https://blog2.17lai.site |
| Content only | tools/cicd.sh -c "desc" | hexo.git + hexoback.git | both domains update |
| Local debugging | tools/cicd.sh -d | no push | local preview only |
2.4 Boundaries & conflicts
- The build runs on Vercel’s cloud (
npm run build), with output going straight onto the CDN; a successful local build doesn’t mean the cloud build succeeds — the Vercel build log is authoritative. - Don’t create a deployment repo besides the production one; testing uses the independent
hexoback.git(next section). - After release, run
tools/tests/release-test.shper the release rule to verify production (20 pages + comment sections + version consistency).
2.5 Summary
- Minimum viable:
tools/cicd.sh -r "desc" - Must verify after release:
tools/tests/release-test.sh - Broke production: revert to the previous git tag, then
-ragain - Content only: use
-c, no version bump
3. Test Domain Flow (hexoback → blog2.17lai.site)
Purpose: verify on the test domain before a real release, keeping broken changes off production. Vercel has a second project listening on
hexoback.git(test repo), deploying tohttps://blog2.17lai.site.Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts
3.1 How to enable
Effect: hexoback.git updates → https://blog2.17lai.site becomes the new version; production blog.17lai.site is completely unchanged.
Corresponding command:
# push the test repo (Vercel auto-deploys to the test domain)
tools/cicd.sh -t "desc" # push test repo (Vercel deploys test domain)
# run PWA smoke + interaction verification on the test domain
make test-pwa # 7-page SW smoke + interaction verificationOutput: -t switches the deploy target to hexoback only and pushes; make test-pwa prints SW smoke results for 7 pages plus interaction findings.
3.2 Common options
① Push production only after tests pass
Effect: the production domain updates with the same output as the test domain, carrying the bumped version number.
Corresponding command:
tools/cicd.sh -r "feature" # official release (version bump + CDN + git tag)
tools/tests/release-test.sh # 【release rule】full layout automated testsOutput: hexo.git gains a commit and tag; release-test.sh prints L1–L14 results.
② Skip the test domain for small changes
Effect: when only content changes, push to both (production + test) directly, saving one wait.
Corresponding command:
tools/cicd.sh -c "desc"Output: both hexo.git and hexoback.git update, with the version number unchanged.
3.3 All tunable keys
| Repo | Watched by | Command | Result |
|---|---|---|---|
hexo.git | Vercel production project | -r / -c | blog.17lai.site |
hexoback.git | Vercel test project | -t / -c | blog2.17lai.site |
3.4 Boundaries & conflicts
- The two repos are fully separate, so testing never pollutes production; but
-treuses the old version, so it does not create a new tag. make test-pwatargets the test domain (blog2.17lai.site), not local port 4000.- Small changes (content only) can skip the test domain and push directly with
-c.
3.5 Summary
- Minimum viable:
-t→make test-pwa - After it passes:
-r→release-test.sh - Posts only:
-c - Test-domain error: fix it and re-run
-t— never go straight to production
4. Docker Build (four modes of tools/cicd.sh)
Purpose:
tools/cicd.shis the full CI/CD entry (proxy → version management → sub-repo sync → config injection → build → PWA version → deploy push), supporting four modes.Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts
4.1 How to enable
Effect: after running -d inside the container, localhost:4000 shows the real posts + unminified + no CDN debug build; config injection and PWA generation still run, but nothing is pushed to any repo.
Corresponding command:
docker compose -f docker-compose.test.yml up -d
docker compose -f docker-compose.test.yml exec hexo bash
# inside the container: tools/cicd.sh -d (local debug build)
exit
docker compose -f docker-compose.test.yml downOutput: public/index.html is regenerated and larger than 1000 bytes; after the PM2 restart, port 4000 returns 200.
4.2 Common options
① The four modes (original comparison table)
| Flag | Purpose | Version | Minify | CDN |
|---|---|---|---|---|
-d / --debug | local debugging | no bump | off | cleared |
-c "desc" / --continue | continuous integration (posts only) | reuse old | on | empty |
-r "feature" / --release | official release | bump + git tag | on | jsdelivr |
-t / --test | local compile test | reuse old | on | empty |
② Observable result of each mode
Effect: at a glance, which domain/repo changed after the command and what the output looks like.
Corresponding modes: the table below is the output difference between the four modes.
| Mode | Push target | Domain change | Output traits |
|---|---|---|---|
-d / --debug | no push | none (local 4000) | unminified, CDN placeholders cleared, debug-readable |
-c "desc" | hexo.git + hexoback.git | both production and test update | minified, no CDN, version unchanged |
-r "feature" | hexo.git | production only | minified + jsDelivr CDN + new tag |
-t / --test | hexoback.git | test domain only | minified, no CDN, version unchanged |
③ Building directly on this machine
Effect: the same output (config injection + pagefind) without Docker, for quick verification.
Corresponding command:
tools/test.sh build # proxies to tools/hexo-build.sh
npx hexo server -p 4100 # local preview, avoiding Docker's 4000Output: public/ is generated; port 4100 is reachable and port 4000 is unaffected.
4.3 All tunable keys
| Option | Value | Purpose |
|---|---|---|
-d / --debug | none | local debugging, no push |
-c / --continue | description string | push to both, version unchanged |
-r / --release | feature string | production only, version bump + tag |
-t / --test | description string | test domain only |
tools/debugBlog.sh true\|false | boolean | switch the debug post set (independent of cicd.sh) |
4.4 Boundaries & conflicts
- The hexo server inside the Docker container maps port host 4000 → container 4000; for local preview use
tools/test.sh serverornpx hexo server -p 4100— the two don’t conflict. - Post-set replacement has been moved out of
cicd.sh(2026-09-23): to speed things up with a small debug post set, runtools/debugBlog.sh truefirst, thentools/cicd.sh -d; restore withtools/debugBlog.sh falsewhen done. Build scripts shouldn’t modify source files. -ddoesn’t push, but it does rewritethemes/matery/_config.yml(the config injection output); that’s expected — don’t commit it as a dirty change.
4.5 Summary
- Minimum viable:
tools/cicd.sh -d+ open port 4000 - Needs pushing:
-c(both) /-t(test) /-r(production) - Port conflict: use 4100 for local preview
- Faster builds:
debugBlog.sh trueis a separate step
5. Release Flow Selection (code vs content)
Purpose: picking the wrong mode means “changed it but production didn’t move” (cache hit on the old version) or an unnecessary version bump.
Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts
5.1 How to enable
Effect: git status --short prints themes/matery/ → code change → must use -r; only source/ prints → content change → -c/-d is enough.
Corresponding command:
git status --short themes/matery/ # dirty → code change → -r
git status --short source/ # content only → -d / -cOutput: lists the changed files; empty output means nothing changed in that directory.
5.2 Common options
Core principle: code changes use -r, content changes use -c/-d.
| Change type | Command | Reason |
|---|---|---|
JS/CSS/theme code (under themes/matery/) | tools/cicd.sh -r "feature" | needs a version bump + git tag so browsers/PWA fetch the new version (unchanged version = cache hit) |
Posts/content only (source/_posts/ etc.) | -d (local preview) or -c "desc" (push) | content updates need no version, incremental release |
| Changing the JS version number | must -r (bump in 3 places, then release) | otherwise production serves the cached old version |
5.3 All tunable keys
| Mode | Version behaviour | How to observe |
|---|---|---|
-r | reads tools/.VERSION, bumps it and creates a git tag | git tag gains one; the page’s ?v= grows |
-c | reuses the old version | tools/.VERSION unchanged |
5.4 Boundaries & conflicts
- The version number is synced in 3 places (
tools/.VERSION,{urlVersion}inuserConfig/_config.tmp.yml,userConfig/sw.tmp.js); miss one and part of the assets stays cached. - Using
-rfor a content-only change needlessly bumps the version and makes every visitor re-download static assets.
5.5 Summary
- Theme code changes:
-r - Post changes:
-c(push) or-d(preview) - Unsure: run
git status --shortfirst to see which directory changed
6. Dual-Repo Commits (submodules)
Purpose: the theme lives in the submodule
themes/matery/; after theme changes both repos must be committed, otherwise the parent repo still points at the old commit.Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts
6.1 How to enable
Effect: the submodule repo gains one commit and the parent repo gains an “update submodule pointer” commit; the parent’s git status no longer shows themes/matery as modified.
Corresponding command:
# 1. commit the submodule
git -C themes/matery add <files>
git -C themes/matery commit -m "[✨] feat(scope): description"
# 2. commit the parent repo (updates the submodule pointer)
git add themes/matery
git commit -m "[🔧] chore: update matery submodule pointer"Output: two commit calls produce one commit each; git status is clean.
6.2 Common options
Local commit convention: [emoji] type(scope): description, one commit does one thing.
| type | emoji | Purpose |
|---|---|---|
| feat | ✨ | new feature |
| fix | 🐛 | bug fix |
| docs | 📖 | documentation |
| refactor | ♻️ | refactoring |
| perf | ⚡ | performance |
| test | 🧪 | tests |
| chore | 🔧 | build/tooling/config |
| style | 🎨 | formatting |
6.3 All tunable keys
| Repo | Path | What’s committed |
|---|---|---|
| Submodule | themes/matery/ | theme code changes |
| Parent repo | repo root | submodule pointer + site content/scripts |
6.4 Boundaries & conflicts
- Committing only the parent without the submodule → the parent pointer still points at the old commit, and the theme change never reaches production.
- The two repos have different remotes (gitea is the main one); check each remote when pushing.
6.5 Summary
- Minimum viable: submodule commit → parent repo pointer commit
- Forgot step two: the parent’s
git statuskeeps showing the submodule as modified - Commit message:
[emoji] type(scope): description
7. Open Graph Metadata (open_graph)
Purpose: generate Open Graph social-sharing metadata for pages (title, description, thumbnail shown when sharing to WeChat/Twitter/Facebook).
Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts
7.1 How to enable
Effect: the page <head> gains og:title / og:description / og:image / twitter:card etc.; paste the link on a social platform and the card shows the title, description and thumbnail.
Corresponding config (theme config):
open_graph:
enable: true
twitter_card: summary_large_image # Twitter card type
twitter_id: # Twitter user ID
twitter_site: # Twitter site @username
google_plus: # Google+ profile
fb_admins: # Facebook admin ID
fb_app_id: # Facebook App IDOutput: after building, the head section of public/posts/<abbrlink>/index.html contains those meta tags.
7.2 Common options
① Default share image
Effect: when a post has no img, home/list share cards use this image; post pages still prefer the post cover.
Corresponding config:
open_graph:
default_og_image: /medias_webp/featureimages/15.webp② Change the Twitter card style
Effect: summary_large_image shows a large-image card; summary shows a small square card.
Corresponding config:
open_graph:
twitter_card: summary7.3 All tunable keys
| Key | Type | Default | Values / range | Purpose |
|---|---|---|---|---|
open_graph.enable | bool | true | true / false | generate OG tags |
open_graph.twitter_card | string | summary_large_image | summary / summary_large_image | Twitter card type |
open_graph.twitter_id | string | empty | Twitter user ID | author attribution |
open_graph.twitter_site | string | empty | @username | site account |
open_graph.fb_admins | string | empty | Facebook admin ID | FB admin |
open_graph.fb_app_id | string | empty | Facebook App ID | FB app |
open_graph.default_og_image | string | — | image path | fallback image when the post has none |
7.4 Boundaries & conflicts
- Based on Hexo’s built-in open_graph helper; with
enable: truethe OG tags are generated automatically from post front-matter (title/description/cover) and read by social platforms on share. - Image priority:
page.img(post image) →theme.default_og_image(default) →theme.featureImages[0]. - Theme config changes must also go into
userConfig/_config.tmp.yml, or the next CI build overwrites them.
7.5 Summary
- Minimum viable:
enable: true - Card has no image: set
default_og_image - Large-image card:
twitter_card: summary_large_image
8. Safe Redirect Page (safego)
Purpose: external-link redirect safety page — outbound links pass through a notice page on this site first, avoiding a direct jump (anti-phishing/anti-tracking).
Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts
8.1 How to enable
Effect: clicking an external link first opens this site’s safety notice page; the visitor only leaves after confirming. When off, the link goes straight to the target site.
Corresponding config (theme config):
safego:
enable: falseOutput: with enable: true, scripts.ejs pulls in libs.js.safego (defer) and css.ejs additionally preloads that script; with false, neither tag appears on the page.
8.2 Common options
① Turn on / off
Effect: true intercepts outbound jumps and shows the notice page; false (default) keeps the native jump with no extra request.
Corresponding config:
safego:
enable: true8.3 All tunable keys
| Key | Type | Default | Values / range | Purpose |
|---|---|---|---|---|
safego.enable | bool | false | true / false | external-link safety notice switch |
8.4 Boundaries & conflicts
- Depends on the
libs.js.safegoasset and thesafegostyles; when missing, the notice page is unstyled or the script doesn’t work. - Reference implementation: Fluid safe jump.
8.5 Summary
- Minimum viable:
enable: true - Off by default: keep
falseif you don’t want the extra click
Appendix: Deployment Quick Reference
| Scenario | Command |
|---|---|
| Local preview | tools/cicd.sh -d or npx hexo server -p 4100 |
| Content-only push | tools/cicd.sh -c "desc" |
| Test domain verification | tools/cicd.sh -t "desc" + make test-pwa |
| Official release | tools/cicd.sh -r "feature" + tools/tests/release-test.sh |
| Fast local build | tools/test.sh build |
| Docker test | docker compose -f docker-compose.test.yml up -d && ... exec hexo bash |