◉◡◉ 您好,欢迎到访伊成个人站!

博客SEO优化之链接持久化

本文于1919天之前发表,文中内容可能已经过时。

“SEO优化”

未优化方案

我们都知道,使用hexo编译的站点打开文章的url是:sitename/year/mounth/day/title四层的结构,这样的url结构很不利于seo,爬虫就会经常爬不到我们的文章,所以,有的博客给的解决方案是:

将url直接改成sitename/title的形式,并且title最好是用英文,在根目录的配置文件下。
具体修改permalink如下:

1
2
3
4
5
6
7
8
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://www.devcheng.net
root: /
#permalink: :year/:month/:day/:title/
#permalink: :posts/:category/:year-:month-:day-:title.html
permalink: title.html
permalink_defaults:

这样写的弊端就是,没次写文章的时候你之能写个英文的title,翻阅了其他资料我发现有更好的方法。

推荐方案

具体操作如下,使用 hexo-abbrlink这个插件。
先安装这个插件,命令如下:

1
npm install hexo-abbrlink --save

站点配置文件里:

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

到此就配置完成了,重新新建文章也不用局限于标题了。是一种比较奈斯的方法,值得你这样配置为了你的站点的SEO。
可以点击我的博客查看效果-www.devcheng.net

支付宝打赏 微信打赏