在此将本站所用插件进行一个汇总,并记录插件功能及其配置方法。
插件安装更新采用 Yarn 包管理器管理。
在此记录以便不时之需!!!
2020-11-04 新增插件 hexo-image-cloudflare,让图片缓存到 Cloudfare 上。
hexo-deployer-git
必装插件,用于将hexo生成的静态文件提交到Github仓库。
安装:
yarn add hexo-deployer-git |
用法:
修改根目录config.yml文件中的
deploy: |
hexo-abbrlink
此插件可以固定文章链接,使文章URL唯一化,有利于SEO。
插件地址: https://github.com/rozbo/hexo-abbrlink
安装:
yarn add hexo-abbrlink |
使用:
修改根目录config.yml文件中的永久链接为
permalink: posts/:abbrlink/ |
alg – Algorithm,rep – Represent参数如下:
crc16 & hex |
hexo-addlink (x)
本插件可以在文章尾部添加当前文章链接,注明版权,有利于SEO。
插件地址: https://github.com/acwong00/hexo-addlink
安装:
yarn add hexo-addlink |
使用:
根目录config.yml文件中添加
# 版权信息 |
hexo-autonofollow
为所有外部链接添加rel =“ external nofollow”
,并添加target =“ _ blank”
使其在新窗口或新标签中打开外部链接,有利于SEO。
地址: https://github.com/liuzc/hexo-autonofollow
安装:
yarn add hexo-autonofollow |
使用:
根目录config.yml文件中添加
# 外链添加nofollow标签 |
hexo-external-link (x)
跳转外链相关插件。自动为所有html文件中外链的a标签生成对应的属性。 比如设置 target='_blank', rel='external nofollow noopener noreferrer'
告诉搜索引擎这是外部链接,不要将该链接计入权重。 同时自动生成外链跳转页面,默认在根目录下go.html;
插件地址: https://github.com/hvnobug/hexo-external-link
安装:
yarn add hexo-external-link |
使用:
在根目录config.yml文件中添加
# 外链跳转 |
参数
变量 | 默认 | 说明 |
---|---|---|
enable | false | 是否开启本插件 |
enable_base64_encode | false | 是否对跳转url使用base64编码 |
url_param_name | u | url参数名,在跳转到外链传递给html_file_name的参数名 |
html_file_name | go.html | 跳转到外链的页面文件路径 |
target_blank | true | 是否为外链的a标签添加target='_blank' |
link_rel | external nofollow noopener noreferrer | 设置外链的a标签的rel属性 |
domain | window.location.host 或者为空 | 如果开启了防盗链,除了 localhost 和 domain 之外调用会跳到主页,同时也是判断链接是否为外链的依据 |
safety_chain | true | go.html 为了防止外链盗用 对域名进行的判断 |
hexo-generator-feed
为hexo博客添加RSS订阅功能
插件地址: https://github.com/hexojs/hexo-generator-feed
安装:
yarn add hexo-generator-feed |
使用:
在根目录config.yml文件中添加
feed: |
集成RSS订阅功能的主题,直接安装此插件,在主题配置文件中修改RSS链接为 /atom.xml
即可,无需在根目录下配置。
hexo-generator-sitemap
为hexo博客添加站点地图文件sitemap
插件地址: https://github.com/hexojs/hexo-generator-sitemap
安装:
yarn add hexo-generator-sitemap |
使用:
在根目录config.yml文件中添加
sitemap: |
若要排除文章或者页面,只需添加sitemap: false
到文章或者页面的 front matter 处即可。
hexo-git-backup
博客源码一键备份到Gihub仓库等源码托管平台的插件。
插件地址: https://github.com/coneycode/hexo-git-backup
安装:
yarn add hexo-git-backup |
若Hexo版本低于3.0,则安装
yarn add hexo-git-backup@0.0.91 |
使用:
在根目录config.yml文件中添加
# Backup 源码备份 |
执行命令即可一键发布文章并备份源码
hexo clean && hexo g && hexo d && hexo b |
hexo-neat
压缩和删除html或其他脚本中的空格和无用的换行符,注释等,以减少网页文件的响应速度,实现网络的快速响应。
插件地址: https://github.com/rozbo/hexo-neat
安装:
yarn add hexo-neat |
用法:
在根目录config.yml文件中添加
# hexo-neat |
根据自己的来合理调整压缩和不需要压缩的文件。
hexo-helper-live2d
向你的Hexo里放上一只萌萌哒二次元看板娘!
插件地址: https://github.com/EYHN/hexo-helper-live2d
安装依赖:
yarn add hexo-helper-live2d |
安装模型:
模型仓库地址: https://github.com/xiazeyu/live2d-widget-models
yarn add {packagename} |
在根目录config.yml文件中添加
# 看板娘 |
hexo-image-cloudflare
一个能够使用 Cloudflare来缓存博客图像的hexo插件,其由 【images.weserv.nl】 驱动。
插件地址: https://github.com/njzjz/hexo-image-cloudflare
安装:
yarn add hexo-image-cloudflare |
可缓存外链图片和本地图片,只需在博客根目录配置好博客域名。
hexo-search
为博客添加站内搜索功能,此插件为本主题 【Fexo】作者写的,优先适配本主题。
插件地址: https://github.com/forsigner/hexo-search
安装:
yarn add hexo-search |
在根目录config.yml文件中添加
search: |
其他主题推荐另一个大众化一点的: https://github.com/wzpan/hexo-generator-search
hexo-wordcount
可以为文章添加字数统计和阅读时长统计,以及站点总字数统计。
插件地址: https://github.com/willin/hexo-wordcount
安装:
yarn add hexo-wordcount |
使用:
Swig
Post Count:
<span class="post-count">{{ wordcount(post.content) }}</span> |
Post Minutes to Read:
<span class="post-count">{{ min2read(post.content) }}</span> |
Total Count:
<span class="post-count">{{ totalcount(site) }}</span> |
Ejs
Post Count:
<span class="post-count"><%= wordcount(post.content) %></span> |
Post Minutes to Read:
<span class="post-count"><%= min2read(post.content) %></span> |
Total Count:
<span class="post-count"><%= totalcount(site) %></span> |
Jade
Post Count:
span.post-count= wordcount(post.content) |
Post Minutes to Read:
span.post-count= min2read(post.content) |
Total Count:
span.post-count= totalcount(site) |
本站主题适配为在article.ejs
中的
<%- partial('component/category') %> |
之后插入
<span class="post-count"> |
效果如下:
结束语
除了Hexo自带的插件之外,自己安装的插件中,有4个与SEO相关;其余1个美化类插件,4个工具型插件。
以上为本站所需插件!!!
本文链接: https://senorui.top/posts/e682.html
版权声明: 本站所有文章除特别声明外,均采用【CC BY-NC-ND 4.0】国际许可协议,若转载请注明出处!