Hexo SEO Optimization (Search Engine Optimization)
Today let’s talk about hexo’s SEO, specifically some search engine optimization for Baidu and Google.
Sitemap
- Install sitemap plugin
npm install hexo-generator-sitemap --save
npm install hexo-generator-baidu-sitemap --save
- Add the following configuration in
_config.yml
sitemap:
path: sitemap.xml
baidusitemap:
path: baidusitemap.xml
- Generate sitemap
hexo clean
hexo g
Baidu Active Push
- Install plugin
npm install hexo-baidu-url-submit --save
- Plugin configuration in
_config.yml
baidu_url_submit:
count: 10 # Number of latest links to submit
host: time-friend.com # Domain registered on Baidu Webmaster Platform, although the official recommendation includes www, it can be without.
token: your_token ## Note: this is your secret key, please don't publish it in public repositories!
path: baidu_urls.txt # Text file address, new links will be saved in this text file
- Deploy configuration in
_config.yml
deploy:
- type: git # Deploy type
repository: xxxxx # Repository
branch: master
- type: baidu_url_submitter # Add this line
- Push and deploy
hexo clean
hexo g