This applies to Windows 10 and Ubuntu 12.04.
Step 1: A GitHub repository for the website
On GitHub, create a repository
Make sure the .gitignore
type is Node
.
Step 2: Setup the Node.js environment
Install Node.js. Then install necessary component:
Step 3: Setup the website
Initialize local folder
Then, in a given folder, initialize the website
In this folder, install a module for commiting to GitHub. Be sure to add --save
so that the module is installed inside this folder and can be used by the server.
Basic configurations for the website
Modify the configuration file
- The site section
- The deployment section, e.g. 1234deploy:type: gitrepo: https://github.com/<yourname>/<yourname>.github.io.gitbranch: master
An alternative for repo
is
In my case, the https
works for Win10, while the git
version works for Ubuntu.
Editing the website locally
To generate and check the website locally
And the website is hosted on
More info:
To add a new article
Then modify the corresponding .md
file in source/_posts
. More info: Writing
Step 4: Deployment on GitHub
To deploy
More info: Deployment
Step 5: Version control (Optional)
Deployment only pushes the generated contents (the public
folder) to GitHub, not the source files. To work on multiple machines, it is beneficial to create an online repository. In this repository, some folders do not have to be tracked:
public
anddb.json
: Generated automatically every time before deployment.node_modules
: Quite large, and not all are necessary. One can repeat Step 3 to create these modules..deploy_git
: Not essential. It can be generated every timehexo
deploys the website. An issue might be the slowness due to a large website.