How to add Google search console to hexo blog
Add Google Search Console (GSC) to hexo blog
Install hexo-sitemap
1 | npm install hexo-generator-sitemap --save |
Add configuration to _config.yml
1 | sitemap: |
This will automatically generate a sitemap every time after deploying the website.
Verify the ownership of your site in GSC
- Go to GSC website
- Under URL prefix, enter your homepage URL.
- Click Continue
- Use “Recommended verification methods”, i.e HTML file.
- Download the automatically generated .html file.
- Put this .html file into the source folder of your blog. (not _post, not anything, just root source folder)
- !IMPORTANT (This has been a big issue for me) Set layout as false in the frontal info of this .html file, otherwise you will get error with verification.
1
2
3
4
5
6
7
8# originally:
google-site-verification: googlee6edfc5f795da21a.html
# now change to:
---
layout: false
---
google-site-verification: googlee6edfc5f795da21a.html - Alternative way for verification is to use HTML tag, see this post
- Add sitemap.xml to sitemap of GSC
- You are all set! After a while of waiting, tap site: your-blog-address into google search window to check if your blog has been properly tracked by GSC.