- Node.js >= 22.14.0
- pnpm 10.7.0
-
克隆项目
git clone <repository-url> cd blog
-
安装依赖
pnpm install- 构建
pnpm build# 创建新文章
hexo new "文章标题"
# 创建新页面
hexo new page "页面名称"
# 创建草稿
hexo new draft "草稿标题"主要配置项说明:
| 配置项 | 说明 | 默认值 |
|---|---|---|
title |
站点标题 | AlienZHOU 的个人站点 |
subtitle |
站点副标题 | '' |
description |
站点描述 | 个人博客,分享JavaScript、CSS... |
url |
站点 URL | https://www.alienzhou.com |
language |
站点语言 | zh-cn |
timezone |
时区 | Asia/Shanghai |
theme |
使用的主题 | minos |
feed:
type: rss2
path: rss.xml
limit: 20 # RSS 文章数量限制blog/
├── _config.yml # Hexo 主配置文件
├── package.json # 项目依赖配置
├── source/ # 源文件目录
│ ├── _posts/ # 文章目录
│ └── ...
├── themes/ # 主题目录
│ └── minos/ # Minos 主题
├── public/ # 生成的静态文件(构建后)
├── scaffolds/ # 文章模板
└── node_modules/ # 依赖包
# 清理之前的构建文件
pnpm clean
# 生成静态文件
pnpm build构建完成后,静态文件将生成在 public/ 目录中。
- 构建项目
pnpm build- 上传 public 目录
将 public/ 目录中的所有文件上传到你的 Web 服务器
根据部署目标,可以在 _config.yml 中配置不同的部署方式:
# GitHub Pages
deploy:
type: git
repo: https://github.com/username/username.github.io.git
branch: master
# FTP
deploy:
type: ftpsync
host: your-ftp-host
user: your-username
pass: your-password
remote: /path/to/website/- 文章格式: 使用 Markdown 格式编写文章
- 图片资源: 建议将图片放在
source/images/目录 - 主题定制: 主题文件位于
themes/minos/目录 - 缓存清理: 如遇到构建问题,先尝试
pnpm clean - 端口冲突: 默认端口 4000,如有冲突可在启动时指定端口
- 构建失败: 检查 Node.js 版本是否符合要求
- 主题问题: 确认主题文件完整性
- 端口占用: 使用
hexo server -p 端口号指定其他端口 - 依赖问题: 删除
node_modules重新安装