Step 1. Create Github Pages

  • Create a new repo at Github and name it username. Github. IO
  • Select a theme in Setting
  • Can use https://username.github.io to access to the home page

Step 2. Hexo environment construction

Hexo is a fast, concise, and efficient blogging framework based on NodeHS.

Recommended tutorials:

  • Very detailed hexo official documentation: https://hexo.io/docs/index.html said
  • Geek college: http://wiki.jikexueyuan.com/project/hexo-document/

2.1 installation Node. Js

  1. Deb.nodesource.com maintains the PPA for each version of the NodeJS installation package, which can be downloaded to perform the import.

     $ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash 
    Copy the code
  2. Next, nodeJS is installed, and NPM is installed automatically.

     $ sudo apt-get install nodejs
    Copy the code
  3. $node -v $NPM -v $node -v $NPM -v

2.2 Installing Hexo using NPM

NPM is the class library that comes with node.js installation. It is one of the largest class libraries in the world. You can install all node.js plug-ins directly through NPM install

$ npm install hexo-cli -g 
Copy the code

Step 3. Create and launch a website

  1. Create a directory of web sites, here named blog

  2. Create a site from the blog directory

     $ hexo init blog
    Copy the code
  3. Enter the blog to install plug-in support

     ~/blog$ npm install
    Copy the code
  4. Start the site

     ~/blog$ hexo server
    Copy the code

    Or use –denug to start debugging

     ~/blog$ hexo s --debug 
    Copy the code
  5. View the site: In your browser, view http://localhost:4000/

Deploy to Github

4.1 configuration making

~/blog$  vim _config.yml
Copy the code

Modify the deploy under

# here the colon must have space deploy: type: git repo: https://github.com/username/username.github.ioCopy the code

4.2 Deploying ebackup on Github

  1. Installing and deploying plug-ins

     ~/blog$ npm install hexo-deployer-git --save
    Copy the code
  2. Cleanup Project (Optional)

     ~/blog$ hexo clean
    Copy the code
  3. The deployment of

     ~/blog$ hexo deploy
    Copy the code

Step 4. Change your blog theme

  1. Enter (https://hexo.io/themes/) Select the topic and enter the appropriate REPO. Bootstrap-blog is used as an example.

    ~/blog$ git clone https://github.com/cgmartin/hexo-theme-bootstrap-blog.git themes/bootstrap-blog
    Copy the code
  2. Install the plug-in according to setup Instructions in README

     ~/blog$ npm install hexo-tag-bootstrap --save
    Copy the code
  3. Change the theme to bootstrap-blog in the _config.yml root directory of the blog

  4. Update and view by clearing the cache hexo clean, then start the server hexo s –debug and type localhost:4000/ in your local browser to see the effect.

Step 5. Create an article

$ hexo new "blog"
INFO  Created: ~/blog/source/_posts/blog.md
Copy the code

Edit the md

--- title: blog1 date: 2018-03-16 15:28:40 tags: tag1 categories: cat1 --- MY FIRST BLOG! // Here is the thumbnail <! -- More --> //Copy the code

After cleaning, start local preview

$ hexo s --debug
Copy the code

5.1 Creating a New TAB

$ hexo new page "github"
INFO  Created: ~/blog/source/github/index.md
Copy the code

Modify the configuration file themes/ theme name /_config.yml to add a page menu in menu.


Hexo reference tutorial: https://www.cgmartin.com/2016/01/03/getting-started-with-hexo-blog/

Topic: https://github.com/cgmartin/hexo-theme-bootstrap-blog