If your blog is built using GitHub + Hexo, your blog content cannot be searched by Baidu, Google and other search engines. Although we host our blog on GitHub, GitHub does not submit site information to search engines. So we can manually submit our blog site to Baidu, Google search engine.


1. Verify the site

There are several methods of search engine verification, I choose the following HTML tag verification method, other methods are interested in you can try, here is not introduced.

  • First open baidu search engine verification, click add website, input their own blog address.

  • After typing, select THE HTML tag verification, and then copy the meta code below, do not close the web page.

  • Open a new page, open Google Search engine verification, click Add Properties and enter your blog address as well. (Google needs to climb over the wall, if you don’t want to climb over the wall, you can skip the Google verification step, just look at baidu’s verification)

  • After typing, select the HTML tag under the alternate method, and then copy the meta code below, leaving the web page open.

  • Open the layout / _partial folder under your local blog theme, a file named head, open it with an HTML editor, and paste in the meta code you just copied.

  • After saving the file, type the following command to redeploy the blog to the GitHub server.

hexo clean && hexo g && hexo d
Copy the code
  • And then click just nowBaidu, GoogleValidate pagevalidationButton for site verification.

2. Generate a site map

  • Open a terminalcdGo to the local blog directory and enter the following command to installsitmapThe plug-in.
npm install hexo-generator-sitemap --save
npm install hexo-generator-baidu-sitemap --save
Copy the code
  • Open the directory of local blogs_config.ymlFile, modifyurlParameter for your blogHome page addressThis is to ensure that it is generated correctlysitemap.xmlAddress in the file.
url: http://jonzzs.cn Change it to the home page of your blog
root: /
permalink: :year/:month/:day/:title/
permalink_defaults:
Copy the code
  • Add the following configuration.
Generate sitemap automatically
sitemap: 
  path: sitemap.xml
baidusitemap: 
  path: baidusitemap.xml
Copy the code
  • Enter the following command to redeploy the blog.
hexo clean && hexo g && hexo d
Copy the code

Submit your sitemap to Google

  • Open theGoogle Site ConsoleTo enter the site console, click firsttestSitemap, click after you pass the testsubmitSite map.


After submission, you can wait for the search engine to automatically grab or configure automatic push or active push site links. If your blog is built using GitHub + Hexo, GitHub seems to prohibit Baidu crawlers from accessing your blog, so your blog may not be included in Baidu, so you can actively push site links. Please refer to this article: Hexo plugin baidu actively submit links.

In the future, you will be grateful for your hard work now, and wish you and your readers a better way of development.

My portal: blog, Book, Twitter, GitHub.