Baidu SEO is a very painful thing, reasonable words should be said to be more troublesome.

Sometimes baidu crawler can not climb our website for various reasons, so we need to take the initiative to submit the link.

Baidu provides three ways for us to submit links:

1. Active push

2. Automatic push

3, a sitemap

I’m going to focus on the auto-push part here.

Take the initiative to push

You can go directly to the Hexo plugin for baidu’s active submission link

Automatic push

Baidu provides a JS script that automatically pushes urls to Baidu when a user visits the page.

The script is as follows:

<script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); }) (); </script>Copy the code

All we need to do is embed this script in our code.

I use the next theme of Hexo, so I looked in Themes/Next/Layout and found that the basic template is _layout.swig, so I added this code to the end of the body of the file. That’s it! It’s very convenient!

sitemap

For sitemap, use hexo-generator-bidu-sitemap and configure it in _config.yml:

baidusitemap:
  path: baidusitemap.xml
Copy the code

That’s it. Submit the sitemap to baidu station platform after the path is good, generally is www.example.com/baidusitemap.xml.