Hexo, blog framework

hexo

Hexo

Hexo is a fast, simple and powerful blog framework based on Node.js.

This blog is written in Markdown, using Hexo and GitHub Pages due to following reasons.

  • Support Markdown, allow you to post easily.
  • Free hosting from GitHub Pages.
  • Users are able to use a wide variety of Themes.

Installation

Requirements

Hexo requires couple of things installed on your machine to run.

If you already installed these, you can skip to Hexo installation

Install Git

  • Windows: Download & install git.
  • Mac: Install it with Homebrew, MacPorts or installer.
  • Linux (Ubuntu, Debian): sudo apt-get install git-core
  • Linux (Fedora, Red Hat, CentOS): sudo yum install git-core

Install Node.js

The best way to install Node.js is with Node Version Manager.
Thankfully the creators of nvm provide a simple script that automatically installs nvm:

cURL:

1
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash

Wget:

1
$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash

Once nvm is installed, restart the terminal and run the following command to install Node.js:

1
$ nvm install stable

Alternatively, download and run the installer.

Install Hexo

Once all the requirements are installed, you can install Hexo with npm:

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


Hexo setup

After installing Hexo, you can set up a new folder for your blog.

1
2
3
$ hexo init <blog_folder_name>
$ cd <blog_folder_name>
$ npm install

Result:

1
2
3
4
5
6
7
8
.
├── _config.yml : configuration file for blog
├── package.json : list of packages in json format
├── scaffolds : scaffolds folder make you able to set up initial seed for post or drafts
├── source : source folder to store markdown files and all other files for blogging
| ├── _drafts
| └── _posts
└── themes : folder to store themes, hexo generate blog based on files in source, and format them with themes


Run

After installing, you can run local server to test Hexo

1
$ hexo server

You can check your server at localhost:4000 (default port: 4000)


Commands

New post

Create a new post

1
$ hexo new "My New Post"

Generate

Generate static files

1
$ hexo generate

OR

1
$ hexo g

Deploy to remote sites

1
$ hexo deploy

OR

1
$ hexo d

More Commands

You can fine more commands in this Link.

Share