bantam.hostbantam.host
CLI Guide

Deploy Hexo with Bantam CLI

A fast, simple & powerful blog framework

Install Bantam CLI:

npm install -g @bantamhq/cli

View on NPM: @bantamhq/cli

Quick start:

# Build your Hexo app
hexo generate

# Deploy it
bantam deploy public

Quick Start

1

Install dependencies

Install Hexo and theme dependencies

npm install
2

Generate static files

Build your blog to static HTML

hexo generate
Creates the public directory with all static files
3

Deploy with Bantam

Your Hexo blog is now live!

bantam deploy public
Get an instant URL like https://my-hexo-blog-abc123.bantam.site

Framework Details

Hexo Configuration

Configure Hexo for production deployment:

_config.yml:

# Site
title: My Hexo Blog
subtitle: 'A blog about tech'
description: 'Technical articles and tutorials'
author: Your Name
language: en
timezone: 'America/New_York'

# URL
url: https://myblog.bantam.host
root: /
permalink: :year/:month/:day/:title/

# Directory
source_dir: source
public_dir: public

# Writing
new_post_name: :title.md
default_layout: post
render_drafts: false

# Theme
theme: landscape
Set your production URL for proper asset paths and SEO metadata.

Theme Configuration

Install and configure themes:

Install a theme:

# Clone theme to themes directory
git clone https://github.com/theme/hexo-theme-next themes/next

# Update _config.yml
theme: next

Theme config (themes/next/_config.yml):

# Menu
menu:
  home: / || fa fa-home
  archives: /archives/ || fa fa-archive
  tags: /tags/ || fa fa-tags
  about: /about/ || fa fa-user

# Social links
social:
  GitHub: https://github.com/username || fab fa-github
  Twitter: https://twitter.com/username || fab fa-twitter

Build Output

Hexo generates a complete static blog in the public directory:

  • index.html - Blog homepage with posts
  • archives/ - Archive pages by date
  • categories/ - Category listing pages
  • tags/ - Tag listing pages
  • 2024/01/15/post-title/ - Individual posts
  • css/ and js/ - Theme assets
Hexo automatically generates archives, categories, and tag pages.

Advanced Usage

Custom Domain

Deploy directly to your own domain

bantam deploy ./dist --domain myapp.com

Permanent Deployment

Keep your site online forever (requires login)

bantam deploy ./dist --permanent

Custom Expiry

Set how long your deployment stays online

bantam deploy ./dist --expiry-days 7

Custom Subdomain

Choose your own subdomain on bantam.site

bantam deploy ./dist --subdomain my-project

CI/CD Integration

Add Bantam to your continuous deployment pipeline:

# GitHub Actions example
- name: Deploy to Bantam
  run: |
    npm install -g @bantamhq/cli
    bantam login --token ${{ secrets.BANTAM_TOKEN }}
    bantam deploy ./dist --domain myapp.com --permanent
Troubleshooting

Common Issues & Solutions

Quick fixes for deployment challenges

01.Theme not loading properly?

Clean and rebuild with theme:

hexo clean
rm -rf node_modules
npm install
hexo generate

Verify theme is in themes directory:

ls themes/
# Should show: your-theme-name

02.Posts not showing up?

Check post front matter format:

---
title: My Post Title
date: 2024-01-15 14:30:00
tags:
  - javascript
  - tutorial
categories:
  - Development
---

Post content here...

Ensure posts are in source/_posts directory

03.Asset paths broken in production?

Use Hexo's asset helpers:

<!-- In templates -->
<%- css('css/style') %>
<%- js('js/script') %>

<!-- For images in posts -->
{% asset_img example.jpg "Image description" %}

<!-- Or use asset folders -->
_config.yml:
post_asset_folder: true

04.Deployment showing old content?

Clean build directory before generating:

# Clean and rebuild
hexo clean && hexo generate

# Or use npm scripts
"scripts": {
  "build": "hexo clean && hexo generate",
  "deploy": "npm run build && bantam deploy public"
}

05.How to add custom pages?

Create pages with hexo new page:

# Create about page
hexo new page about

# Creates source/about/index.md
---
title: About
date: 2024-01-15
---

About page content...