preface

First contact with writing the code I want to take a blog, your own personal technology is used to record normal development problems encountered in the process of peace when some kind of learning, etc., but at that time I don’t know how to set up their own blog, and then more and more busy working this things are delayed, recently, want to force yourself to record some some of your usual time learning, etc., I decided to use Hexo+Github to build my own blog, because Hexo is relatively easy to build, and Hexo uses Markdown to render and analyze articles, making it very convenient to write articles.

Hexo profile

Hexo is a fast, concise and efficient blogging framework. Hexo 官网 address: hexo. IO /zh-cn/

Environmental installation

Git installed

I believe that many programmers use Git, so there is no need to describe Git installation, students who do not use Git here recommend a Git installation tutorial

  • Go to your Github account and create a new Repository named [your_username.github. IO]
  • If you want to Deploy your url to Github, add a Deploy key to the Setting configuration under your_username.github

For details about how to create an SSH key, see:

  • Help.github.com/articles/ge…

Homebrew is installed

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Copy the code

Node. Js installed

Install directly using Homebrew
$ brew install node
Copy the code
Download the Node.js package to install it

Node.js download at nodejs.org/

Hexo installation

$ npm install -g hexo-cli
Copy the code

Initialize the blog

After installing Hexo, create a Blog folder and execute the following instructions to complete the Hexo initialization

$ cd Blog
$ Hexo init
$ npm install
Copy the code

The deployment of blog

Once Hexo is initialized, you can test your blog to see if it has been successfully set up by executing the following command

$CD Blog $Hexo Post "One of my blogs" $Hexo g $Hexo ServerCopy the code

Run the following command and enter http://localhost:4000 to check whether the local blog is accessible

Post a blog to Github

Once the Blog is initialized, we can publish our Blog to Github, open the _config.yml file in the Blog folder, go to deploy, and configure as follows:

deploy:
  type: git
  repository: https://github.com/your_user_name/you_user_name.github.io.git
  branch: master
Copy the code

To commit to Github you need to install the hexo-Deployer-git plug-in

$ npm install hexo-deployer-git --save
Copy the code

Wait until the hexo-deployer-git plug-in is installed and execute the following instructions to complete the hexo release

$ Hexo clean
$ Hexo g
$ Hexo d
Copy the code

At this point, wait patiently. If you need to input your Github account username and password, you can publish.

Modify the Hexo default theme

My blog theme here uses the next theme. If you need to customize the theme, you can go to the following address to view the tutorial changes:

theme-next.iissnan.com/ hexo.io/themes/

Writing articles Hexo

After the completion of the blog, you can be happy to record your study ah, personal experience and what.

$ cd Blog
$ Hexo new post "xxxxxxx"
Copy the code

Once you’ve finished writing your article, you can republish it to Github with the following instructions:

$ Hexo clean
$ Hexo g
$ Hexo d
Copy the code