Other structures,

Quick build blog first: get started quick build blog second: change the Next theme quick build blog third: beautify collect a lot of questions quick build blog fourth: writing skills include map bed and automatic map bed plug-in quick build blog fifth: optimize blog

It’s easy to set up a blog, but there are a lot of holes. I may have made some mistakes, please point them out in the comments. But there are tested ones. The version I’m using is Hexo4.0 + NexT7.6.

My personal blog

We have to push our website to the search engine, otherwise people will not be able to find our blog beyond entering our domain name.

How to check if my site is included:

Site: your website like mine: site:flunggg.cnCopy the code

If there is an article, there is no article.

1. Site map

A sitemap, or sitemap, is a page that places links to all the pages on your site that need to be crawled by search engines. Sitemap can tell search engines what pages are available to crawl, so search engines can crawl more intelligently.

2. Generate a site map

Install baidu and Google sitemap generation plug-in:

npm install hexo-generator-baidu-sitemap --save
npm install hexo-generator-sitemap --save
Copy the code

Then go to the site directory configuration file _config.yml and add it below:

# site map
sitemap: 
  path: sitemap.xml
baidusitemap:
  path: baidusitemap.xml
Copy the code

Then push it back to the server after accessing the following URL

https:// Your domain name /sitemap.xml https:// Your domain name/baidusItemap.xmlCopy the code

See if any code appears. If there is, there is success.

3. Baidu included

3.1 Baidu Webmaster

Through baidu webmaster platform for link submission, increase the site index. Go registering and logging in first: Baidu webmaster platform

Then the picture is as follows:

I chose https://, which depends on whether you added SSL certificates earlier. And I’m using one without the WWW, looking at individuals. And then step three, which I like to do with CNAME validation, is to add a mapping to domain name resolution.

3.2 Link Submission

Baidu webmaster platform link submission methods are divided into automatic submission and manual submission, here only automatic submission, manual submission according to the requirements of operation.

3.2.1 Active Push

Active push is the fastest way to submit, and is the fastest way to be included by Baidu. Active push can be achieved by installing plug-ins:

npm install hexo-baidu-url-submit --save
Copy the code

Then go to the site directory configuration file _config.yml and add:

# Active push baidu, Baidu included
baidu_url_submit:
  count: 10 # submit the latest 10 links
  host:  # Baidu webmaster platform registered domain name
  token:  Interface call address in the token field
  path: baidu_urls.txt The new link will be saved in the text file
Copy the code

Second, remember to check the url value in the _config.yml file, which must include the domain name registered by baidu webmaster platform, such as: mine

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: https://flunggg.cn/
root: /
permalink: archives/:abbrlink.html
Copy the code

Finally, add new deployer:

deploy:
- type: git ## This is my original deployer
  repo:
  branch:
- type: baidu_url_submitter ## Add the content here
Copy the code

The realization principle of its active push is as follows:

  • The creation of new links,hexo generateA text file containing the latest links is generated
  • Submission of new links,hexo deployIt will read the link from the above file and submit it to Baidu search engine

3.2.2 Automatic push

You can see a bidu-push. swig file in themes\next\layout\_third-party, which should come with the next version now. So you don’t have to configure it. If not, create a file named bidu-pusher. Swig in this directory. Then add:

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

3.3.3 sitemap submission

Also called manual push. Put the following code:

https:// Your domain name /sitemap.xml https:// Your domain name/baidusItemap.xmlCopy the code

Copy and paste it here and submit it. My results are below, indicating success.

Note: BAIDU webmaster’s HTTPS authentication is ignored, I originally configured, always HTTPS authentication failed, because there is still HTTP link, but the HTTP transfer to HTPPS can not be. Now suddenly you see success, maybe you turned HTTP off on the server side. And Baidu webmaster included site very slowly, about half a month after the site was included. And it took me a week to push data. There was no push at first. Only now. But I still don’t see my article.

4. 4. Smart refrigerator

Submitting to The Google search engine is relatively easy, before submitting, we can still use site: domain to see if the site is included, Google crawler is really powerful, I can now see my articles even without submitting them. Cow force!!!!! Unlike so-and-so push so long no effect.

Go to Google Webmaster and log in to your Google account. Then do the following, if the first time you pop up a box asking you to enter the domain name, just enter the domain name of the site you want to include.

I chose the first one. Then you have to wait a day.

And then you have to verify, and I borrowed the picture below, because I already verified it. Copy that TXT record, then go to domain name resolution, use TXT to map.

You can also download an HTML file and put it in source under the site directory and push it to the server.

You don’t have to worry about it. The next day it will be automatically included.

5. Included by Bing

Bing collection is also very simple, click on the Bing webmaster. First register login, bing included in two ways, one use just Google import past, the second is to add their own URL

Then need not manage, nevertheless must answer to also collect slower also, just collect my home page now just, but faster than Baidu.

Helpful please point a thumbs-up, thank you! Build blog series complete!