以前一直都不明白 seo 是个什么东西.

但是最近重新用 hexo 记录一些学习过程. 写完手贱在 google 上搜了一下, 什么都搜不到, 于是 seo 这个词就蹦到了我的脑子里. 原来 seo 是干这个的.

sitemap Link to heading

Sitemap即网站地图,它的作用在于便于搜索引擎更加智能地抓取网站。最简单和常见的sitemap形式,是XML文件,在其中列出网站中的网址以及关于每个网址的其他元数据

使用的hexo plugin Link to heading

npm install hexo-generator-sitemap --save
npm install hexo-generator-baidu-sitemap --save

root下_config.yml 添加

#hexo sitemap
sitemap:
  path: sitemap.xml
baidusitemap:
  path: baidusitemap.xml

添加 robots.txt Link to heading

robots.txt(统一小写)是一种存放于网站根目录下的ASCII编码的文本文件,它的作用是告诉搜索引擎此网站中哪些内容是可以被爬取的,哪些是禁止爬取的。 在 source 目录下增加 robots.txt 文件,网站生成后在网站的根目录(站点目录/public/)下。

User-agent: *
Allow: /
Allow: /archives/
Allow: /categories/
Allow: /tags/

Disallow: /vendors/
Disallow: /js/
Disallow: /css/
Disallow: /fonts/
Disallow: /vendors/
Disallow: /fancybox/

Sitemap: https://<your_domain>/sitemap.xml
Sitemap: https://<your_domain>/baidusitemap.xml

Allow表示允许被访问的,Disallow是不允许的意思。注意后面两个Sitemap就是网站地图了。而网站地图前面说了是给爬虫用的。这里配置在robots中。

交给 google Link to heading

登录 google search console, 在抓取->站点地图中可以看到添加站点地图,添加sitemap.xml即可.

robots.txt 也是同理.添加即可.

有人说一下这一步很重要, 我填上了主页//categories.

crawl->fetch as google 中手动添加你想要添加的连接.

添加nofollow标签 Link to heading

nofollow 标签目的是告诉搜索引擎不要抓带有 nofollow 的任何出站连接, 以减少分散权重.(这里博主懒, 没有做.)

next 自带 seo优化 Link to heading

主题配置文件_config.yml中有个 seo 选项, 默认是false, 改成true.

hexo 根目录下的_config.yml中 title, subtitle, description 什么的也填填好.

credit to Link to heading

时光丶flies