0%

Build your personal blog

Goal

This documentation is to introduce how to build your personal blog by Git and Hexo.

Installation

Git

1
brew install git

NPM

NPM is the package manager for Node.

1
2
brew install npm
npm config set registry https://registry.npm.taobao.org

Hexo

Hexo is an open source, convenient framework to help you quickly build your blog.

1
2
npm install hexo-cli -g
npm install hexo-deployer-git --save

Post blog Steps

Initialization Hexo

1
2
3
4
hexo init myblog<your project name>
cd myblog
npm install
export PATH=$PATH:~/.nvm/versions/node/v12.16.0/bin

Create new page

1
2
hexo new "MyFirstBlog"<your blog name>
# write your blog through *.md file.

Restart

1
hexo clean && hexo deploy

Onboard Google Search Console

  1. Go to the Search Console Page.
  2. Paste your url at URL prefix.
  3. Download the Html file.
  4. Put the download Html file under source directory.
  5. Add the layout Head as below:
    1
    2
    3
    4
    5
    ---
    layout: false
    ---

    google-site-verification: google03c774646bdb5e4a.html
  6. hexo d -g
  7. Verify at the Google Search Console.

Add SiteMap

Sitemap is to a file(Xml,etc.) to tell GoogleSeaqrchEnginte the structure information about the website.

Generate the Sitemap file

The tool.

1
$ npm install hexo-generator-sitemap --save

Modify themes/next_config.yml:

1
2
3
4
5
6
7
8
9
menu:
home: / || home
#about: /about/ || user
tags: /tags/ || tags
categories: /categories/ || th
archives: /archives/ || archive
#schedule: /schedule/ || calendar
sitemap: /sitemap.xml || sitemap
#commonweal: /404/ || heartbeat

Restart

1
hexo clean && hexo g

Add the sitemap to google

  1. By web: http://www.google.com/webmasters/tools/
  2. By command line: curl https://www.google.com/ping?sitemap=https://opsmilesum.github.io/sitemap