Hexo框架(十二):本博客使用插件备忘
最近对博客主题进行了一次升级,顺便在这里记录一下本博客使用的插件,做个备忘。
插件 | 功能 | 版本 |
---|---|---|
hexo-deployer-git | 一键部署 | ^2.1.0 |
hexo-symbols-count-time | 字数统计与阅读时长 | ^0.7.1 |
hexo-generator-searchdb | 本地搜索 | ^1.2.0 |
hexo-abbrlink | url 持久化 | ^2.0.5 |
hexo-filter-nofollow | 减少出站链接 | ^2.0.2 |
hexo-baidu-url-submit | 百度推送 | ^0.0.6 |
hexo-generator-baidu-sitemap | 百度站点地图 | ^0.1.6 |
hexo-generator-index-pin-top | 置顶 | ^0.2.2 |
hexo-neat | 博文压缩 | ^1.0.4 |
hexo-related-popular-posts | 相关文章推荐 | ^4.0.0 |
hexo-cake-moon-menu | 返回按钮 | ^2.1.0 |
hexo-generator-sitemap | 站点地图 | ^2.0.0 |
hexo-filter-emoji | emoji 表情支持 | ^2.2.1 |
hexo-generator-archive | ^1.0.0 | |
hexo-generator-category | ^1.0.0 | |
hexo-generator-index | ^1.0.0 | |
hexo-generator-tag | ^1.0.0 | |
hexo-renderer-ejs | ^1.0.0 | |
hexo-renderer-stylus | ^1.1.0 | |
hexo-renderer-marked | ^2.0.0 | |
hexo-server | ^1.0.0 |
注意:目前我以采用数据文件的方式进行更新,下文所指的主题配置文件
,现在均指hexo/soure/_data/next.yml
Hexo 一键部署插件
地址
安装配置
安装插件:
1 | npm install hexo-deployer-git --save |
然后修改站点配置文件
中的配置:
1 | deploy: |
字数和阅读时间统计插件
地址
安装配置
安装插件:
1 | npm install hexo-symbols-count-time --save |
站点配置文件
中添加以下代码:
1 | symbols_count_time: |
然后由于此插件集成在 NexT 中,然后修改主题配置文件
:
1 | # 文章字数统计 |
Hexo 本地搜索功能
插件地址
安装配置
安装插件:
1 | npm install hexo-generator-searchdb --save |
然后我们修改站点配置文件
,添加如下内容:
1 | # 本地搜索 |
- path:索引文件的路径,相对于站点根目录
- field:搜索范围,默认是 post,还可以选择 page、all,设置成 all 表示搜索所有页面
- limit:限制搜索的条目数
然后修改主题配置文件
:
1 | local_search: |
Hexo 文章永久链接插件
地址
安装配置
安装插件:
1 | npm install hexo-abbrlink --save |
然后我们可以在站点配置文件
中修改为:
1 | # URL |
Hexo 减少出站链接
地址
安装配置
安装插件:
1 | npm install hexo-filter-nofollow --save |
再在站点配置文件
中添加配置,将 nofollow
设置为 true
:
1 | nofollow: |
这样,例外的链接将不会被加上 nofollow
属性。
Hexo 百度主动推送
地址
安装配置
安装插件:
1 | npm install hexo-baidu-url-submit --save |
在站点配置文件
中添加以下代码:
1 | # 百度主动推送 |
Hexo 站点地图 sitemap 生成
通用站点地图
安装配置:
1 | npm install hexo-generator-sitemap --save |
然后我们需要在 Hexo 站点配置文件
中加入 sitemap 插件:
1 | # 通用站点地图 |
百度站点地图
安装配置:
1 | npm install hexo-generator-baidu-sitemap --save |
具体配置类似通用站点地图,当然也可以看官方提供的教程,下面是一个简单的配置,我们在 Hexo 站点配置文件
中添加:
1 | # 百度站点地图 |
Hexo 文章置顶插件
地址
安装配置
安装插件:
1 | npm uninstall hexo-generator-index --save #卸载原来的插件 |
在需要置顶的文章的 Front-matter
中加上 top: true
或者 top: 任意数字
,比如:
1 | title: 谢谢你来看我的博客 |
注意:top 中数字越大,文章越靠前。
设置置顶图标
打开 /themes/next/layout/_macro/
目录下的 post.swig
文件,在 的第一个
标签下,插入如下代码:
更新为将此代码放置到hexo/source/_data/post-meta.swig
文件中
1 | {% if post.top %} |
next.yml 设置
1 | custom_file_path: |
Hexo 页面静态资源压缩插件
地址
安装配置
安装 hexo-neat 插件
安装插件:
1 | npm install hexo-neat --save |
站点配置文件
添加相关配置
然后我们需要在站点配置文件
中添加以下代码:
1 | # 博文压缩 |
Hexo 推荐文章插件
地址
安装配置
安装插件:
1 | npm install hexo-related-popular-posts --save |
我们只需要在主题配置文件
中修改:
1 | related_posts: |
Hexo 修改 back2top 标签
地址
安装配置
安装插件:
1 | npm install hexo-cake-moon-menu --save |
然后在站点配置文件``_config.yml
中添加以下代码:
1 | moon_menu: |
Hexo 添加 emoji 表情支持
地址
安装配置
- 安装插件
1 | npm install hexo-filter-emoji |
- 站点配置文件
.config.yml
中增加:
1 | emoji: |
参考资料
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 你真是一个美好的人类!