seo优化

SEO (Search Engine Optimization ) 中文意“搜索引擎优化”

优化一是对站内排版进行 SEO 的优化,二就是对搜索引擎的主动的优化

提交站点

1.安装sitemap插件

1
npm install hexo-generator-sitemap --save

2.配置_config.yml 的 url 为站点地址

1
2
url: https://xy-bz.github.io/
root: /

生成 sitemap.xml 文件(搜索引擎通用文件)提交到站点

最好检查一下能否访问sitemap.xml,比如我的路径为https://xy-bz.github.io/sitemap.xml

3.新建 robots.txt 文件

在根目录 source 文件下新建 robots.txt 文件,配置爬虫文件(浏览器其实就是爬虫)

1
2
3
4
5
6
7
8
9
10
11
12
13
# hexo robots.txt
User-agent: *
Allow: /
Allow: /archives/
Disallow: /vendors/
Disallow: /js/
Disallow: /css/
Disallow: /fonts/
Disallow: /vendors/
Disallow: /fancybox/

Sitemap: https://xy-bz.github.io/sitemap.xml
Sitemap: https://xy-bz.github.io/baidusitemap.xml

4.减少垃圾链接

nofollow 标签是“反垃圾链接”标签;用于指示搜索引擎即抓取网页上的带有 nofollow 属性的

任何出站链接,减少垃圾链接的分散网站权重

一般出站连接主要是一些友情连接,集中在footer,注意下在a标签下增加rel=”external nofollow”即可

完成了上面四项一定要hexo d -g提交,要不然后面Google在抓取(索引)的时候会失败

5.提交网站

google 站长,进入登录谷歌,添加网站

之后验证网站,按提示来;

6.提交站点地图

提交后若成功可以在下面看到状态

7.抓取

点左边的网址检测,这时没有索引,点击右下申请索引,等待两三分钟就可以了

8.测试

输入site:域名,测试一下,成功