Guides to Hexo

Hexo 建站指南

安装hexo

1
npm install -g hexo-cli

初始化hexo项目

1
2
3
cd site
hexo init
npm install # 安装相关package

配置

修改 _config.yaml 中的配置。

主题

安装next主题

1
git clone https://github.com/iissnan/hexo-theme-next themes/next

修改 _config.yaml,切换到新的主题 theme: next

主题配置

将 themes/THEME/_config.yml 链接到 source/_data/THEME.yml。

页面结构

创建tags、categories页面。

创建页面

1
hexo new page "tags"

编辑 source/tags/index.md,设置页面类型为 tags。需要注意,title域要和themes/next/languages/zh-CN.yml中的名称对应,不然无法匹配翻译。

1
2
3
4
5
---
title: tag # 写tags,会无法翻译
date: 2018-08-10 19:54:01
type: "tags"
---

编辑 source/_data/next.yaml ,将新建的页面添加到菜单中。

1
2
3
4
menu:
home: /
archives: /archives
tags: /tags