A tutorial for building your own website make use of github and hexo, with a beautiful theme “material-x”.
Install hexo
You should alread install git and nodejs.
1 | $ npm install -g hexo-cli |
Hexo create a directory for your project:
1 | $ hexo init <folder> |
Hexo will build a skeleton for your site:
1 | $ npm install |
Test whether everything is ok:
1 | $ hexo server |
If it works well. you can change the theme, which can be found on hexo site. I will use material-x
theme :
1 | $ cd themes |
Then install dependencies:
1 | $ npm i -S hexo-generator-search hexo-generator-feed hexo-renderer-less hexo-autoprefixer hexo-generator-json-content hexo-recommended-posts hexo-helper-qrcode |
Go to the your project’s root directory, and configure the file _config.yml.
Item theme: change its value to your theme’s name, for example:
1 | theme: material-x |
Install git deploy plugin
Look for deploy item ,and modify it like follow:
1 | deploy: |
After that we are going to install git deploy plugin:
1 | $ npm install hexo-deployer-git --save |
Latsly, you can configure your theme according to this tutorial .
Deploy to your github website
Before deploy it to github, test it on local machine:
1 | $ hexo generator # or hexo g |
Open a browser ,input following address:
1 | http://localhost:4000/ |
If work well deploy it to github
1 | $ hexo deploy # or hexo d |
Create a repo for your theme
Change your pwd to your installed theme directory. Then use browser to create a repo and name it (e.g.hexo-theme-material-x). Change remote origin to your repo and add the origin author’s repo as remote upstream for later updating.
1 | $ git remote -v |
If upstream has update, you can use fetch command to get it and merge upstream/master to local master:
1 | $ git fetch upstream |
Push to remote repo:
1 | $ git push origin master |