How to Get Your Hexo Blog Indexed by Baidu: A Step‑by‑Step Guide
This article explains how to verify Baidu indexing for a Hexo‑based blog, create a Baidu webmaster account, add HTML verification tags, generate and submit sitemaps, and enable automatic push so the site is reliably crawled and listed by Baidu.
Most bloggers host their sites on GitHub or Coding, which block crawlers, so manual submission to Baidu is required. The author demonstrates the process using a Hexo blog with the NEXT theme.
To check if your blog is already indexed, search site:yourdomain.com on Baidu; results indicate successful indexing.
Step 1: Create a Baidu Webmaster account – register at https://ziyuan.baidu.com if you don’t have one.
Step 2: Verify site ownership – use the verification page https://ziyuan.baidu.com/site/siteadd , enter your blog’s URL (GitHub Pages or Coding), and follow the prompts.
Step 3: HTML verification – add the Baidu verification meta tag to every page’s head . For the NEXT theme, edit _config.yml to include baidu_site_verification: true , then modify themes/next/layout/_partials/head.swig to insert the meta tag:
{% if theme.baidu_site_verification %}
{% endif %}After rebuilding the site, open the homepage and press F12 to confirm the meta tag appears in the head section.
Step 4: Generate a sitemap – install the plugins:
npm install hexo-generator-sitemap --save
npm install hexo-generator-baidu-sitemap --saveUpdate _config.yml with the correct URL , then add sitemap configuration:
# 自动生成sitemap
sitemap:
path: sitemap.xml
baidusitemap:
path: baidusitemap.xmlRun hexo g to generate sitemap.xml and baidusitemap.xml in the public folder.
Step 5: Submit the sitemap – either wait for Baidu’s automatic crawl, manually submit the sitemap in Baidu Webmaster, or enable automatic push.
Automatic push configuration – set baidu_push: true in _config.yml , then create or edit themes/next/layout/_scripts/baidu_push.swig with the following script:
{% if theme.baidu_push %}
{% endif %}With this configuration, each visit to the blog’s homepage automatically pushes the URL to Baidu, eliminating the need for manual submissions.
In summary, although Baidu indexing involves several steps, following this guide makes the process straightforward for anyone maintaining a Hexo blog.
Code Ape Tech Column
Former Ant Group P8 engineer, pure technologist, sharing full‑stack Java, job interview and career advice through a column. Site: java-family.cn
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.