Hexo - Add Site Map

Float up to the top in Google search! Yes, only Google not Baidu the second largest search engine in the world.

Why Sitemap

Day 7 with Hexo, another task done.

Goal: add sitemap for search engines

Why: I just realized today, to let search engines, like Google, to find your blog, you need to create a sitemap.

Lan’s Complain: I failed to add my sitemap to dear Baidu.com (Chinese alternative to Google). I don’t have a Baidu account and it requires Chinese phone number for registration. This is one of the hundreds trails failed during this Hexo development project. How difficult to be a Chinese aboard?! I don’t mention the time wasted try different plugins and services.

Sitemap Creation

This is the easy part. The time consuming part will follow in the next section.

Step 1: install the plug-in

1
npm install hexo-generator-sitemap --save

Step 2: setup sitemap in blog _conf.yml. Add the following:

1
2
sitemap:
path: sitemap.xml

Step 3: generation

1
hexo g

Step 4: check public folder and you should see sitemap.xml

Submit Sitemap to Google

Go to Google Search Console and login with your Google account.

Step 1: Add Property

Step 2: Verification File

Lan: here I chose HTML Tag

Step 3: Add Verification Code

Go to theme_name\layout_partial\head\head.swig and add the HTML tag:

Step 4: Deploy your Hexo blog and Google Search Console will show

Step 5: Submit sitemap

Step 6: Click URL inspection. Important: Wait Patiently!

Lan: It took me approximately 1 hour until I saw the following picture. I did lots of research to figure out why I encountered nth failure today during this very long hour…instead I suggest you just relax and maybe go to bed. Miracle will happen tomorrow morning when you get up fresh.

Step 7: You are on Google finally! Let me celebrate my 8th Day with Hexo…