How to search in Baidu and Google to find your blog – hexo SEO optimization

Time:2020-2-1

Introduction

After writing personal blog, I hope to find my own article in Baidu search engine, so SEO optimization is needed. Here is the optimization of Google and Baidu crawlers.

text

What is SEO?

Search engine optimization, also known as SEO (search engine optimization), is a technology to understand how search engines search, how to grab Internet pages and how to determine the ranking of search results for specific keywords by analyzing the ranking rules of search engines.
The search engine adopts the means that are easy to be cited by the search engine to optimize the website, improve the natural ranking of the website in the search engine, attract more users to visit the website, improve the visit amount of the website, improve the sales ability and publicity ability of the website, so as to improve the brand effect of the website. Baidu Encyclopedia

Site map

Generate sitemap files for local articles

NPM install hexo generator sitemap — save ා sitemap.xml is suitable for submitting to Google search engine
NPM install hex-generator-baidu-sitemap — save ා Baidu sitemap.xml is suitable for submitting to Baidu search engine

Modify the following configuration in the root directory ﹤ config.yml:

How to search in Baidu and Google to find your blog - hexo SEO optimization

Pay attention to the indentation of the format. I tried to report errors many times before and found that it was the format problem.

Modify the following configuration in the root directory ﹤ config.yml:

How to search in Baidu and Google to find your blog - hexo SEO optimization~~~~

After the configuration is completed, hexo G can generate sitemap.xml and baidusitemap.xml in the root directory public; the first one will be submitted to Google in a while, and the latter one will be submitted to Baidu according to the name;

Add the roberts.txt file

Add the roberts.txt file under the root directory source

How to search in Baidu and Google to find your blog - hexo SEO optimization

And then hexo D-G submits it

Baidu included site

In Baidu webmaster platform user center = > site management add your site URL:

How to search in Baidu and Google to find your blog - hexo SEO optimization

There are three ways to verify the website in the last step. I choseFile verification

1. HTML tag verification (of which: content should be replaced with its own.)

  • Set: Baidu site verification: true in the theme’s ﹣ config.yml file, and add it manually if there is no such field.
  • Add the following code to the themes / Materialflow / layout / [partials / head.swig file

How to search in Baidu and Google to find your blog - hexo SEO optimization

2. File verification, follow the steps of Baidu webmaster. (the hexo root directory is under the resource folder of the project directory)
Note: the following errors may be reported

Baidu? Verify? V5nndapnhd.html is the file downloaded by the site

How to search in Baidu and Google to find your blog - hexo SEO optimization

This is because when hexo compiles the file, it will add other content to the downloaded HTML file, resulting in validation failure. For example, downloading the original file content is

How to search in Baidu and Google to find your blog - hexo SEO optimization

But in GitHub, the file content of Baidu ﹣ verify ﹣ v5nndapnhd.html is like this… A lot

How to search in Baidu and Google to find your blog - hexo SEO optimization

Therefore, you need to manually modify and verify the HTML file in GitHub, and change the content of the HTML file on GitHub to the content given by the webmaster.

Sitemap submitted to Baidu webmaster

Link submission tool is a tool for websites to actively push data to Baidu search. This tool can shorten the link time of websites discovered by crawlers. It is recommended to use link submission tool for timely content of websites to push data to search in real time. It is a lightweight link submission component, which places the automatically pushed JS code in the source code of each page of the site. When the page is visited, the page link will be automatically pushed to Baidu, which is conducive to the faster discovery of new pages by Baidu..

Log in Baidu webmaster platform, in the left menu barLink submitMedium. There are three ways to submit. I use sitemap verification

How to search in Baidu and Google to find your blog - hexo SEO optimization

If Auto push is selected, the configuration is as follows:

  • Set Baidu? Push to true in the theme configuration file
  • Create the baidu_push.swig file under the path themesmaterialflowlayout. The contents of the file are as follows
{% if theme.baidu_push %}
<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>
{% endif %}

Google included sites

Because there’s no wall climbing software, there’s no toss(^▽^)。。。

Finally: of course, check whether it has been included

Method: open Baidu or Google search, and enter in the search box:

Site: https://lzzhy.github.io/ (please replace lzzhy with your own)

If the prompt says, “I’m sorry, we didn’t find a page related to” site: https://maxwell.github.io “. Description not included.

If you see your blog site at the first glance in the search results, it means it has been included

Please refer to my blog for more details