向大佬学习,hexo SEO优化
未优化方案
我们都知道,使用hexo编译的站点打开文章的url是:sitename/year/mounth/day/title
四层的结构,这样的url结构很不利于seo,爬虫就会经常爬不到我们的文章,所以,有的博客给的解决方案是:
将url直接改成sitename/title的形式,并且title最好是用英文,在根目录的配置文件下。
具体修改permalink如下:
# 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这个插件。
先安装这个插件,命令如下:
npm install hexo-abbrlink --save
站点配置文件里:
permalink: post/:abbrlink.html
abbrlink:
alg: crc32 # 算法:crc16(default) and crc32
rep: hex # 进制:dec(default) and hex
到此就配置完成了,重新新建文章也不用局限于标题了。是一种比较奈斯的方法,值得你这样配置为了你的站点的SEO。
这里附上大佬的地址 :http://www.devcheng.net/
向大佬学习,hexo SEO优化
https://blog.cikaros.top/doc/32abd75e.html