Hexo Upgrade SEO

Hexo Upgrade SEO

這篇介紹How to upgrade Hexo SEO。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
功能:縮短文章路徑

安裝lib:
$ npm install hexo-abbrlink --save

修改 /root/_config.yml
url: #網址url必須設定,產生sitemap.xml才會正確
permalink: posts/:abbrlink/

abbrlink:
alg: crc32 #support crc16(default) and crc32
rep: hex #support dec(default) and hex

memo:最下方加入即可

attention: .md內的 layout: 必須移除,在hexo g 才會針對每個.md產生 abbrlink:

hexo-filter-nofollow

1
2
3
4
5
6
7
8
9
10
11
12
功能:指示搜尋引擎不要抓取有設定nofollow的網站連結,避免分散網站權重。

安裝lib:
$ npm i hexo-filter-nofollow --save

修改 /root/_config.yml
nofollow:
enable: true
field: site
exclude: # 不加上 nofollow 的友情連結可以放在這邊。
- 'https://aaa.blog'
- 'https://bbb.com'

robots.txt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
新增 /root/source/robots.txt

檔案內容:
User-agent: *
Allow: /
Allow: /archives/
Allow: /categories/
Allow: /tags/
Disallow: /vendors/
Disallow: /js/
Disallow: /css/
Disallow: /fonts/
Disallow: /vendors/
Disallow: /fancybox/
Sitemap: https://你的網域/sitemap.xml

說明:
User-agent: * 允許所有的搜尋引擎
Allow 允許被訪問
Disallow 不允許被訪問

keywords & description

1
2
3
在/root/scaffolds/post.md 加入
keywords:
description:

Google Search Console

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
https://search.google.com/search-console/about?hl=zh-tw

點選立即開始

網址前置字元 輸入 URL
點選繼續

這邊需經過驗證(方法有很多種
---

到 [Google Search Console後台 - Sitemap - 新增Sitemap] 填寫sitemap.xml

有兩點需注意
1.日期格式 <lastmod>2021-09-07</lastmod> 才是正確的
2.修改 /root/_config.yml
url: #網址url必須設定,產生sitemap.xml才會正確

在google search site:{url} 確認是否能找到網站

檢測網站工具

1
2
https://developers.google.com/speed/pagespeed/insights
https://web.dev/measure/