hexo推荐插件配置

推荐常用的hexo常见插件及其配置

文章链接处理

hexo的文章的永久链接是配置在_config.yml下的permalink, 且通常配置成:year/:month/:day/:title/,这样文章对应的连接会如下 https://yoursite.com/2019/03/24/hexo%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/ 其中文章中中文部分会被url编码,同时会带上文章的日期

这会带来什么问题呢?首先不利于seo,中间带有url编码的中文,同时也带上了日期信息中也带有斜杠符号,增加的url解析层次,较短的url便于seo。(一般seo只跑三层)

这里推荐使用插件 hexo-abbrlink

npm install hexo-abbrlink -save

站点配置文件修改成如下:

1
2
3
4
permalink: post/:abbrlink.html # 带上`html`后缀标识静态文件,利于seo搜索。
abbrlink:
alg: crc32 # 算法:crc16(default) and crc32
rep: hex # 进制:dec(default) and hex

最后连接变成了 /post/afcbc60d.html 对比下刚才贴的 2019/03/24/hexo%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/ 是否简单清晰多了。

首页摘要展示

在文章中加入<!--more-->即可,在首先显示这标签前的内容,如果前面没有内容,相当于无效。

显示categories和tags页面

默认是不显示这两个页面的,处理方法如下

  1. 执行命令生成具体页面

    1
    2
    hexo new page tags
    hexo new page categories
  2. 配置页面

tags

1
2
3
4
5
6
---
type: tags
layout: tags
noDate: true
comment: false
---

categories

1
2
3
4
5
6
---
type: categories
layout: categories
noDate: true
comment: false
---

原创技术分享,您的支持将鼓励我继续创作