Introduction
Hexo is an alternative of jekyll to create static blog pages from markdown on Github Pages. Implemented with nodejs, Hexo is quite easy to use compared with jekyll. Using Hexo and a theme named “NexT”, I am here now to demonstrate how to create a pretty nice blog site on Github Pages within just a few minutes.
Prerequisites
To begin with, you’ll need:
- node
- git
- a github account
Step By Step
1. install hexo
npm install -g hexo-cli
2. create git repository
Create a git repository with the name bellow:
<username>.github.io
Just leave it empty and don’t initialize it with .gitignore or README.md or LICENSE.
3. initialize your blog directory
Initialize your git repository directory structure locally
|
|
4. config your blog site
Open _config.yml and modify options as your wish. Here’s some of them that may be useful.
- title
- author
- url
- language
- theme: change to “next” if you wanna replace the default one
- deploy: the git branch should be master
|
|
Check out a more-detailed document on Hexo official pages
5. ( optional ) switch blog theme to “NexT”
- First remove default theme: landscape
|
|
- Download Hexo “NexT” theme release package, and do not use git submodule since we have to modify its config files later.
wget https://github.com/iissnan/hexo-theme-next/archive/v5.1.1.zip
- unzip theme content to theme/next folder
- config theme as your wish in theme/next/_config.yml
- check out config docs for more details.
6. deploy to Github Pages
hexo clean && hexo generate && hexo deploy
7. submit your source code
Remember to submit your code to git repository in a different branch.
git push
8. check out your Github Pages blog site.
Keep posting blogs using Hexo
Create a new post
|
|
More info: Writing
Run server
|
|
More info: Server
Generate static files
|
|
More info: Generating
Deploy to remote sites
|
|
More info: Deployment