1. Install Hexo CLI globally.
npm install -g hexo-cli
hexo init <project-name>
Follow the instructions here: How to Change Hexo Themes.
This blog is using NexT theme if you’re interested.
Don’t forget to commit it:
git add _config.yml
Go to Personal access tokens page on GitHub,
Generate a new token with repo scopes. Copy that generated token.
Open Travis CI, add your
blog repo and then go to Settings.
Add an Environment Variables with
GH_TOKEN as name and paste that token as value. Save it.
.travis.yml file to your project with the following content:
.travis.yml (Click to open)
git add .travis.yml
Push your project.
git remote add origin https://github.com/<your-username>/blog.git
Open the repo’s Settings on GitHub, navigate to GitHub Pages section.
gh-pages branch is selected as the Source option.
Check the webpage at your-username.github.io/blog !
From now on, you can even add or edit posts on GitHub directly!
Travis CI will detect the updates and rebuild your page for you!