Hexo Static Site Generator - Commands and Themes
Hexo is a fast, simple and powerful blog framework powered by Node.js. This guide covers the essential commands and workflow, plus a curated list of excellent themes to get you started.
Quick Start
Create a New Post
1 | hexo new "My New Post" |
Creates a new markdown file in source/_posts/ with frontmatter template.
More info: Writing
Run Development Server
1 | hexo server |
Starts local server at http://localhost:4000 for previewing your site.
More info: Server
Generate Static Files
1 | hexo generate |
Generates static HTML files in the public/ directory.
More info: Generating
Deploy to Remote Sites
1 | hexo deploy |
Deploys your site to configured hosting (GitHub Pages, Netlify, etc.).
More info: Deployment
Common Workflow
Clean and Regenerate
1 | # Clean cached files and generated static files |
Use this when you change config or encounter rendering issues.
Development Workflow
1 | # Start with clean slate |
Deployment Workflow
1 | # Test locally first |
Writing Content
Markdown Syntax
Hexo uses Markdown for content. Quick reference:
1 | # Heading 1 |
Complete guide: Markdown Syntax
Post Frontmatter
1 |
|
Tags and Categories
1 | # Create a new post with tags |
Configuration Tips
_config.yml Essentials
1 | # Site |
Theme Configuration
Each theme has its own _config.yml in themes/theme-name/ directory. Common settings:
1 | # Navigation menu |
Recommended Hexo Themes
Production-Ready Themes
Cactus - Minimalist Blog Theme
- Demo: https://probberechts.github.io/hexo-theme-cactus/
- GitHub: https://github.com/probberechts/hexo-theme-cactus
- Features: Clean design, responsive, dark mode, analytics support
- Best for: Personal blogs, developers, writers
Obsidian - Modern & Feature-Rich
- Demo: https://tridiamond.me/
- GitHub: https://github.com/TriDiamond/hexo-theme-obsidian
- Features: Modern UI, search, comments, multiple layouts
- Best for: Tech blogs, portfolios, documentation
Meadow - Elegant & Simple
- Demo: https://garybear.cn/
- GitHub: https://github.com/kb1000fx/hexo-theme-meadow
- Features: Beautiful typography, smooth animations, mobile-first
- Best for: Photography blogs, creative portfolios
3-Hexo - Advanced Features
- Demo: https://yelog.org/
- GitHub: https://github.com/yelog/hexo-theme-3-hexo
- Features: Complex catalog, advanced navigation, rich widgets
- Best for: Technical documentation, knowledge bases, large blogs
Installing a Theme
1 | # Clone theme into themes directory |
Popular Theme Collections
- Official Themes: https://hexo.io/themes/
- GitHub Topics: hexo-theme
- Awesome Hexo: Collection of plugins and themes
Choosing a Theme
Consider these factors:
Design Style
- Minimalist vs. feature-rich
- Light vs. dark vs. both
- Typography preferences
Features Needed
- Comments (Disqus, Gitalk, etc.)
- Search functionality
- Analytics integration
- Social sharing buttons
- Code syntax highlighting
Performance
- Page load speed
- Mobile responsiveness
- SEO optimization
Maintenance
- Last updated date
- Active development
- Community support
- Documentation quality
Customization
- Easy color changes
- Layout options
- Widget flexibility
Essential Plugins
Extend Hexo functionality with plugins:
1 | # SEO |
Troubleshooting
Port Already in Use
1 | # Kill process on port 4000 |
Changes Not Showing
1 | # Clear cache and regenerate |
Theme Not Loading
1 | # Verify theme directory |
Deployment Issues
1 | # Clean before deploying |
Quick Reference
1 | # Installation |
Useful Links
- Official Documentation: https://hexo.io/docs/
- API Documentation: https://hexo.io/api/
- Plugin List: https://hexo.io/plugins/
- Theme List: https://hexo.io/themes/
- GitHub: https://github.com/hexojs/hexo
- Community: https://discuss.hexo.io/
Conclusion
Hexo provides a powerful yet simple platform for creating static websites. Key points:
- Use
hexo cleanwhen you encounter issues - Test locally with
hexo serverbefore deploying - Choose a theme that fits your needs and style
- Keep your Hexo and plugins updated
- Leverage Markdown for easy content creation
- Deploy frequently to keep your site fresh
Start with the basic commands, pick a nice theme, and customize as you go. Hexo’s flexibility allows you to grow from a simple blog to a complex website as your needs evolve.