Fork me on GitHub

Hexo之URL持久化

前言

hexo默认生成的文章地址路径是[网站名称/年/月/日/文章名称].这种链接对搜索爬虫是很不友好的,第一它的url结构超过了三层,太深了. 如何优化呢?

优化详解

安装插件

1
$ npm install hexo-abbrlink --save

在站点配置文件_config.yaml中添加如下配置

1
2
3
4
5
# permalink: :title/
permalink: archives/:abbrlink.html
abbrlink:
alg: crc32 # 算法:crc16(default) and crc32
rep: hex # 进制:dec(default) and hex

注:html前缀为:对标题+时间进行md5然后再转base64

效果展示

看本文URL即可,哈哈哈.

参考资料

hexo-abbrlink介绍

======================================================
希望各位朋友支持一下

本文作者:dongsheng
本文地址https://mds1455975151.github.io/archives/e7a9455c.html
版权声明:转载请注明出处!

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