想要让更多人看到你的网站,就需要进行 SEO优化,目的就是让搜索引擎更加快速的收录你网站的信息,从而提升网站的曝光度。

网页目前 SEO 情况

PageSpeed Insights,输入博客域名,可知道目前网页状况

20250528033034023

URL 链接优化

hexo-abbrlink 能将网页链接转化为永久链接存储在文章中

1
2
# 在 hexo 根目录运行
npm install hexo-abbrlink --save

修改根目录 _config.yml

1
2
3
4
5
6
7
8
url: https://240799.xyz
permalink: posts/:year:month:day/:abbrlink.html
abbrlink:
alg: crc32
rep: dec
drafts: false
force: false
writeback: true

sitemap

hexo-generator-sitemap 当 Hexo 产生网站的静态资源时,会在 Public 目录下自动生成 sitemap.xmlbaidusitemap.xml

sitemap.xml 是搜索引擎通用的 sitemap 文件,baidusitemap.xml 是百度专用的 sitemap 文件

1
2
3
# 在 hexo 根目录运行
npm install hexo-generator-sitemap --save
npm install hexo-generator-baidu-sitemap --save

修改根目录 _config.yml

1
2
3
4
5
6
7
8
9
10
11

sitemap:
# path:sitemap 路径
path: sitemap.xml
# tags:是否要包含标签
tags: true
# categories:是否要包含分类
categories: true

baidusitemap:
path: baidusitemap.xml

提交谷歌搜索

访问 Google Search Console,新增资源,添加网域的 DNS 设定并提交 sitemap.xml

image-20250528035255902

提交百度搜索

访问 百度搜索资源平台官网,注册或者登陆百度账号,依次选择【用户中心】-【站点管理】,选择添加站点,提交 baidusitemap.xml

image-20250528041633041

设置自动推送网站链接

添加 robots.txt

./source 新增 robots.txt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
User-agent: *
Allow: /
Allow: /archives/
Allow: /categories/
Allow: /tags/
Disallow: /vendors/
Disallow: /js/
Disallow: /css/
Disallow: /fonts/
Disallow: /vendors/
Disallow: /fancybox/

Sitemap: https://240799.xyz/sitemap.xml
Sitemap: https://240799.xyz/baidusitemap.xml