Hexo 是一个轻量级静态博客框架,通过 Markdown + Node.js 就可以快速搭建个人博客。

本文总结了 Hexo 写博客时最常用的操作方法。

创建分类页

在博客根目录执行:

1
hexo new page categories

然后打开:

1
source/categories/index.md

修改为:

1
2
3
4
5
6
---
title: 分类
date: 2022-11-11
type: categories
layout: categories
---

创建标签页

1
hexo new page tags

修改:

1
2
3
4
5
6
---
title: 标签
date: 2022-11-11
type: tags
layout: tags
---

创建文章

1
hexo new post "我的第一篇博客"

生成:

1
source/_posts/我的第一篇博客.md

文章头部格式:

1
2
3
4
5
6
7
8
9
---
title: 文章标题
date: 2022-11-11 10:30:00
description: 文章摘要
categories:
- Hexo
tags:
- 教程
---

插入图片

将图片放入:

1
source/images/

然后写:

1
![示意图](/images/example.png)

发布博客

1
2
3
hexo clean
hexo g
hexo d

博客就会自动部署到 GitHub Pages。