Files
BlueRoseNote/07-Other/Node.js/Hexo/Hexo插件开发笔记.md

53 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 前言
除却辅助函数hexo的插件还可划分为不同类型控制台 (Console)、部署器 (Deployer)、过滤器 (Filter)、生成器 (Generator)、迁移器 (Migrator)、处理器 (Processor)、渲染引擎 (Renderer)、标签 (Tag)。
案例链接:
- https://www.cnblogs.com/an-shiguang/p/18269046#comment_form_container
-
## 命令
- hexo generate --watch监视文件变动并立即重新生成静态文件。
- hexo generate --deploy完成后部署。
# 相关自定义概念
## 永久连接
定制MD生成页面的链接格式 https://hexo.io/zh-cn/docs/permalinks
## 主题
https://hexo.io/zh-cn/docs/themes
一个主题可能会有以下的结构:
```text
.
├── _config.yml
├── languages
├── layout
├── scripts
└── source
```
- _ config.yml主题的配置文件。 和 Hexo 配置文件不同,主题配置文件修改时会自动更新,无需重启 Hexo Server。
- languages语言文件夹。 请参见 [国际化 (i18n)](https://hexo.io/zh-cn/docs/internationalization)。
- layout布局文件夹。 用于存放主题的模板文件,决定了网站内容的呈现方式。 Hexo 内建 [Nunjucks](https://mozilla.github.io/nunjucks/) 模板引擎,您可以另外安装插件来获得 [EJS](https://github.com/hexojs/hexo-renderer-ejs) 或 [Pug](https://github.com/hexojs/hexo-renderer-pug) 支持。 Hexo 根据模板的文件扩展名选择模板引擎(就像帖子一样)。
- scripts脚本文件夹。 在启动时Hexo 会加载此文件夹内的 JavaScript 文件。 请参见 [plugins](https://hexo.io/zh-cn/docs/plugins). 以获得更多信息。
- sourceSource 文件夹。 将您的素材(如 CSS 和 JavaScript 文件)放在这里。 文件或文件夹开头名称为 `_`(下划线)或隐藏的文件会被忽略。
## 模版
https://hexo.io/zh-cn/docs/templates
模板决定了网站内容的呈现方式。 以下是各页面相对应的模板名称。 每个主题至少都应包含一个 `index` 模板。
| 模板 | 页面 | 回退 |
| ---------- | ---- | --------- |
| `index` | 首页 | |
| `post` | 文章 | `index` |
| `page` | 分页 | `index` |
| `archive` | 归档 | `index` |
| `category` | 分类归档 | `archive` |
| `tag` | 标签归档 | `archive` |
## 变量
https://hexo.io/zh-cn/docs/variables
## 辅助函数
https://hexo.io/zh-cn/docs/helpers
## 过滤器列表
https://hexo.io/zh-cn/api/filter#%E8%BF%87%E6%BB%A4%E5%99%A8%E5%88%97%E8%A1%A8