Vercel is one of the smoothest ways to deploy a static site — connect your repository and every push to main triggers an automatic build and deploy. For a Hexo blog, the whole process takes under five minutes to set up.
Prerequisites
- A Hexo site in a GitHub, GitLab, or Bitbucket repository
- A Vercel account (free tier is plenty for a blog)
Your repository should have at minimum:
1 | |
Step 1 — Import the Project
- Go to vercel.com/new
- Click Import Git Repository
- Select your Hexo site repo
- Vercel will auto-detect it as a Node.js project
Step 2 — Configure Build Settings
Vercel might not detect Hexo automatically. Set these manually in the Configure Project step:
| Setting | Value |
|---|---|
| Framework Preset | Other |
| Build Command | npm run build |
| Output Directory | public |
| Install Command | npm install |
Your package.json should have:
1 | |
Step 3 — Environment Variables
If you want to enable Vercel Analytics (Vaultex supports this natively), set:
1 | |
In themes/vaultex/_config.yml:
1 | |
This injects the Vercel Speed Insights script only when the environment variable is set.
Step 4 — Deploy
Click Deploy. Vercel will:
- Clone the repository
- Run
npm install - Run
hexo generate - Serve the
public/directory as a static site
The first deploy takes ~30–60 seconds. Subsequent deploys are faster due to caching.
Custom Domain
After the initial deploy:
- Go to your project’s Settings → Domains
- Add your domain (e.g.,
blog.example.com) - Add the provided DNS records to your domain registrar:
- An
Arecord pointing to Vercel’s IP, or - A
CNAMErecord pointing tocname.vercel-dns.com
- An
SSL certificates are provisioned automatically via Let’s Encrypt.
Update your Hexo _config.yml to use the real URL:
1 | |
Rebuild and deploy — the sitemap and feed will use the correct base URL.
Automatic Deploys
Every push to the default branch (usually main) triggers a production deploy. Every push to any other branch creates a Preview Deployment — a unique URL for testing changes before merging.
This workflow:
1 | |
Creates a preview URL like https://my-blog-git-draft-new-post.vercel.app where you can review the rendered post before it goes live.
Vercel Configuration File
For advanced control, add a vercel.json to the repo root:
1 | |
This adds long-lived caching for fonts and basic security headers.
Troubleshooting
Build Fails — Theme Not Found
If Hexo can’t find the theme, check _config.yml:
1 | |
And confirm the theme is committed to the repository (not git-ignored).
Missing Plugins
If hexo-generator-search or other plugins aren’t in package.json, add them:
1 | |
Then commit the updated package.json and package-lock.json.
public/ in .gitignore
Make sure public/ is in .gitignore — Vercel builds this directory itself. Committing it causes conflicts and bloats the repository.
1 | |
Once it’s running, a Vercel-deployed Hexo blog with Vaultex requires essentially zero maintenance — push Markdown, get a live post. That’s the pitch.