Hexo
Fast blog-focused SSG built with Node.js. Over 38k GitHub stars, featuring rich themes and plugins.
トレンド・動向
Maintains high popularity centered in China. Appreciated for blog-focused features and rich customizability.
# Static Site Generator
Hexo
## Overview
Hexo is a fast blog-focused static site generator built with Node.js. It generates beautiful blog sites from Markdown files with simple commands and provides a rich ecosystem of themes and plugins. Highly popular especially in China, it has earned over 38k GitHub stars and offers powerful customization capabilities.
## Details
### Key Features
- **Blazing Fast**: Lightweight and ultra-fast site generation powered by Node.js
- **Blog-Focused**: Built-in support for posts, categories, tags, and blog-specific features
- **Rich Themes**: Hundreds of themes available with easy customization options
- **Plugin System**: Powerful plugin architecture for unlimited extensibility
- **Markdown Support**: Full GitHub Flavored Markdown compatibility
- **One-Command Deployment**: Direct deployment to GitHub Pages, Heroku, Netlify, and more
- **Internationalization**: Built-in i18n support for multi-language sites
## Pros and Cons
### Pros
- Blog-specific features out of the box, enabling quick setup of practical blogs
- Extensive theme and plugin ecosystem with high customization flexibility
- Low learning curve - can start immediately with Markdown knowledge
- Active community with comprehensive documentation
- Fast builds and hot-reload development server
### Cons
- Structure not suitable for non-blog use cases
- Difficult to handle large-scale sites or complex requirements
- Limited integration with modern JS frameworks like Vue.js/React
- Plugin quality varies, requiring verification of maintenance status
## Reference Pages
- [Official Website](https://hexo.io/)
- [Official Documentation](https://hexo.io/docs/)
- [GitHub Repository](https://github.com/hexojs/hexo)
- [Theme Gallery](https://hexo.io/themes/)
- [Plugin List](https://hexo.io/plugins/)
## Code Examples
### Hello World (Basic Setup)
```bash
# Install Hexo CLI
npm install hexo-cli -g
# Create new project
hexo init my-blog
cd my-blog
npm install
# Start development server
hexo server
```
### Post Creation and Metadata
```bash
# Create new post
hexo new "My First Post"
```
```yaml
---
title: My First Post
date: 2024-01-15 10:30:00
tags: [Hexo, Blog, Tutorial]
categories: [Getting Started]
---
# Welcome to Hexo!
This is my first post. I can write in **Markdown**.
- List item 1
- List item 2
[Example link](https://hexo.io/)
```
### Theme Configuration and Config File
```yaml
# _config.yml
title: My Blog
subtitle: Tech Notes and Life Hacks
description: Writing about programming and daily life
author: Your Name
language: en
timezone: UTC
# Theme configuration
theme: landscape
# URL configuration
url: https://yourblog.github.io
root: /
permalink: :year/:month/:day/:title/
# Deployment configuration
deploy:
type: git
repo: https://github.com/yourusername/yourusername.github.io.git
branch: main
```
### Plugin Installation and Usage
```bash
# RSS generator plugin
npm install hexo-generator-feed --save
# Sitemap generator plugin
npm install hexo-generator-sitemap --save
# SEO plugin
npm install hexo-seo --save
```
```yaml
# Plugin configuration in _config.yml
feed:
type: atom
path: atom.xml
limit: 20
sitemap:
path: sitemap.xml
# SEO configuration
seo:
enable: true
auto_description: true
auto_keywords: true
```
### Custom Pages and Layouts
```bash
# Create About page
hexo new page about
```
```markdown
---
title: About
date: 2024-01-15 12:00:00
layout: page
---
# About Me
This is a page to introduce myself.
## Background
- 2020: Graduated from university
- 2020: Started working as an engineer
## Skills
- JavaScript
- Node.js
- Vue.js
```
### Deployment and Build
```bash
# Generate static files
hexo generate
# Deploy to GitHub Pages (using deploy plugin)
npm install hexo-deployer-git --save
hexo deploy
# Clean build
hexo clean && hexo generate
# Generate and deploy simultaneously
hexo generate --deploy
```