How to show your Hexo blog on Google search

Add a website property to Search Console

  1. Go to Google Search Console.

  2. Under URL prefix, enter your homepage URL.

  3. Click CONTINUE.

Verify your site ownership

  1. Under “Other verification methods”, select HTML tag.

  2. Copy and paste the meta tag inside <head> section of your site’s homepage.

    In my case, I go to blog/themes/cactus/layout/_partial/head.ejs and paste it inside the <head> section:

    head.ejs
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    <head>
    <!-- so meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="HandheldFriendly" content="True">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5" />

    // other codes...

    <meta name="google-site-verification" content="zLOg-wm0CWmnn7HIsEiEjiz2B_93RmWxLAudRxe2JHk" />
    </head>
  3. Deploy your site to commit changes.

  4. Click VERIFY.

  5. Click GO TO PROPERTY.

Submit your sitemap to Google

A sitemap is a file that lists all of the pages of a website and how they’re related to each other.

  1. Under the root directory of your Hexo project, download hexo-generator-sitemap plugin.

    $ npm install hexo-generator-sitemap --save
  2. Configure _config.yml under the root directory:

    • Add property:

      _config.yml
      1
      2
      sitemap:
      path: sitemap.xml
    • Update url:

      _config.yml
      1
      url: https://foystor.github.io/
  3. Generate sitemap.

    $ hexo clean
    $ hexo g

    You can see sitemap.xml file generated inside the public folder under the root directory.

  4. Deploy your site to commit changes.

  5. Add your sitemap.

  6. Click SUBMIT and wait for Google crawling your site.

    Crawling can take anywhere from a few days to a few weeks.





References

Make your Jekyll Github Pages appear on Google search result (2 steps)

让谷歌搜索到自己在GitHub上的博客

Google sitemap 不允许的网址的解决办法