安知鱼主题配置
主题安装
(npm安装):
1 | npm i hexo-theme-anzhiyu |
此方法只支持 Hexo 5.0.0 以上版本 通过 npm 安装并不会在 themes 里生成主题文件夹,而是在 node_modules 里生成
应用主题
打开 Hexo 根目录下的 config.yml, 找到以下配置项,把主题改为anzhiyu
1 | # Extensions |
安装 pug 和 stylus 渲染插件
1 | npm install hexo-renderer-pug hexo-renderer-stylus --save |
无法安装可以使用cnpm进行安装
1 | npm install hexo-renderer-pug hexo-renderer-stylus --save --registry=http://registry.npmmirror.com |
本地启动 hexo
1 | hexo cl |
文章生成永久链接
使用 hexo-abbrlink 的 Hexo 插件来实现文章生成永久链接,安装命令如下:
1 | npm install hexo-abbrlink --save |
在 Hexo 根目录下的 _config.yml 文件中,新增以下的配置项:
1 | abbrlink: |
将 _config.yml 文件中的 permalink 的值修改为如下内容:
1 | permalink: posts/:abbrlink.html |
执行 hexo clean && hexo g 重新生成博客文件,就可以生成永久链接。生成完后,原 md 文件的 Front-matter 内会增加 abbrlink 字段,值为生成的 ID 。
顶部图
如果不要显示顶部图,可直接配置disable_top_img: true
顶部图的获取顺序,如果都没有配置,则不显示顶部图
主色调相关配置
可以把文章页面顶部颜色从文章中提取对应的颜色显示
1 | mainTone: |
文章置顶
hexo-generator-index 从 2.0.0 开始,已经支持文章置顶功能。你可以直接在文章的 front-matter区域里添加 sticky: 1 属性来把这篇文章置顶。数值越大,置顶的优先级越大
字数统计
要为 AnZhiYu 配上字数统计特性, 你需要如下几个步骤:
打开 hexo 工作目录
1 | npm install hexo-wordcount --save or yarn add hexo-wordcount |
修改 主题配置文件:
1 | wordcount: |
搜索功能
安装插件
1 | npm install hexo-generator-search --save |
可以在根 _config.yml 中配置这个插件
1 |
|
修改 主题配置文件
1 | local_search: |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 z00o!