Github+hexo Build Your own blog site (vi) Advanced Configuration (search engine ingest, optimize your URL)

Source: Internet
Author: User

Detailed view of the Hexo blog demo: https://saucxs.github.io/

Domain name bound: http://www.chengxinsong.cn

Hexo+github blog site source code (can clone, run, see the blog presentation. Feel can give a star): Https://github.com/saucxs/hexo-blog-origin.git

First, search engine included

1. Verify site Ownership

Login Baidu Webmaster Platform: http://zhanzhang.baidu.com, as long as there is Baidu's account can log in, after the successful login in the site management click Add Site and then enter your site address, the proposed website for the WWW start, Do not enter Github.io, because GitHub is not allowed Baidu spider crawl content on GitHub, so if you want your site to be included in Baidu, can only use their own domain name purchased

Click Other tools, my site, site management, to complete site validation,

After selecting the type of site you need to verify ownership of the site, there are three ways to verify ownership of the site: file validation. HTML tag validation and CNAME parsing validation,

It is easier to use either of these, but it is important to note that the location where the file is used to verify the file needs to be placed in the source folder, and if it is an HTML file then Hexo will compile it, so it must be added so that it will layout:false not be compiled by Hexo. (If you do not need to verify that the file is in txt format),

The other two ways is also very simple, I personally recommend file verification and CNAME authentication, CNAME authentication is the simplest, just add a parse on the good ~

I chose the CNAME to add a parse, as shown in:

The host record is your choice CNAME authentication, Baidu gives out, the record value is also you choose CNAME authentication, Baidu gives out.

2. Generate Site Map

We need to use NPM to automatically generate Sitemaps for our site, and then submit the generated sitemap to Baidu and other search engines

Installing the Sitemap plugin
NPM Install Hexo-generator-sitemap-save     npm install Hexo-generator-baidu-sitemap--save
Modify the Blog configuration file

Modify the URL for your site address in the root directory configuration file _config.yml

# URL
# # If Your site is put in a subdirectory, set URL as ' Http://yoursite.com/child ' and root as '/child/'
url:http://www.chengxinsong.cn
Root:/
#permalink:: year/:month/:d ay/:title/
Permalink::p osts/:category/:year-:month-:d ay-:title.html
Permalink_defaults:

Perform

Hexo d-g

After the execution is completed,

The sitemap.xml file and the Baidusitemap.xml file are generated at the root of the Web site and can be http://www.chengxinsong.cn/baidusitemap.xml to see if the file is generated, Which Sitemap.xml file is a search engine common files, Baidusitemap.xml is Baidu dedicated sitemap file.

3. Submit a link to Baidu

Then we can submit our generated sitemap file to Baidu, or Baidu Webmaster platform, find links to submit.

There are two types of submissions, auto-commit and manual submission, and auto-commit into active push, auto-push and Sitemap

How to choose a link submission method
1, the initiative to push: the most rapid way of submission, we recommend that you will be the site of the new output link immediately by this way to push to Baidu, to ensure that the new link can be included in time by Baidu.
2, Automatic push: The most convenient way to submit, please automatically push the JS code deployed in each page of the site source code, the deployment of code page each time it is browsed, the link will be automatically pushed to Baidu. Can be used in conjunction with active push.
3, Sitemap: You can regularly put the site link in the sitemap, and then submit the Sitemap to Baidu. Baidu will periodically crawl check the Sitemap you submitted, the link to the processing, but included slower than the active push.
4, Manual submission: one-time submission of links to Baidu, you can use this method.

From efficiency: Proactive push > Auto push >sitemap

3.1 Active push

Tools--Web Capture--Link submission

Locate the key.

Then install the plug-in in your local project

And then add a field to the root directory of the configuration file _config.yml

baidu_url_submit:                       Submit the latest link  host:www.chengxinsong.cn     # in the Baidu Webmaster platform registered domain name  token:nxxxxxxxxxxxxxxx       # Please note that this is your secret key, so please do not publish the blog source code in the public warehouse !   Path:baidu_urls.txt          # The address of the text document, the new link will be saved in this text document

In addition to the new Deploye

-Type:baidu_url_submitter

When this is done hexo deploy , the new link will be pushed.

3.2 Auto Push

Set the new Baidu_push setting to True under the theme configuration file:

fortrue

Subsequent re-fill 、、、

Second, optimize the URL

SEO search engine optimization that the best structure of the site is the user from the first click three times can reach any page , but we use Hexo compiled site open the URL of the article is: Sitename/year/mounth/day/title four layer structure , such a URL structure is very unfavorable to SEO, crawler will often not climb to our article, so we can change the URL directly into the form of Sitename/title, and the title is best in English, in the root directory of the configuration file modified permalink as follows:

 in a subdirectory, set URL as ' Http://yoursite.com/child ' and root as '/child/'url:http://
   
    www.chengxinsong.cnRoot:/
    #permalink::year/:month/:d ay/:title/
    #permalink::p osts/: category/:year-:month-:d ay-
    : title.htmlpermalink:title.htmlpermalink_defaults:
   

Build Hexo+github Series Study:

1, Github+hexo build their own blog site (a) Basic introduction

2, Github+hexo build their own blog site (ii) change the theme Yilia

3, Github+hexo build their own blog site (iii) some basic configuration other than the theme (picture location, article directory function)

4, Github+hexo to build their own blog site (iv) Some basic configuration (statistical configuration, website visit volume display) outside the theme

5, Github+hexo build their own blog site (v) Advanced Configuration (to make blog comments)

Github+hexo Build Your own blog site (vi) Advanced Configuration (search engine ingest, optimize your URL)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.