Setting up a Github Pages blog with Hexo on Mac
Install
Install node.js
|
|
Installing Node.js and NPM is pretty straightforward using Homebrew. Homebrew handles downloading, unpacking and installing Node and NPM on your system. The whole process (after you have XCode and Homebrew installed) should only take you a few minutes.
- To see if Node is installed, type
node -v
in iTerm. This should print the version number so you’ll see something like thisv7.7.4
. - To see if NPM is installed, type
npm -v
in iTerm. This should print the version number so you’ll see something like this4.1.2
.
Install Hexo
|
|
- To see if Hexo is installed, type
hexo -v
in iTerm.
Setup Hexo
Once you’ve got Hexo installed, you can simply run:
Next, we need to configure a couple of things so open up the config file:
Some items you’ll want to immediately change are:
- title
- description
- author
- url
To make Github deployments work withhexo deploy
you’ll want to make sure that the# Deployment
section looks something like:123456# Deployment## Docs: https://hexo.io/docs/deployment.htmldeploy:type: gitrepo: https://github.com/username/username.github.io.gitbranch: master
Setup Github
Github provides hosting for static websites via Github Pages. As long as you have an index.html in the root of your repo, Github will serve up the static files for you.
Create a new repository for your blog
You can get this setup by creating the required repository for your new blog, simply create a new repo with the name format as \
Generate some content
Now that everything is assembled in place, it’s time to flesh out the blog. To generate a new post in Hexo simply issue:
Now you can go ahead and add your content, and then when finished, simply run:
And your new blog will be live at http://username.github.com