Hexo + Github Pages
Hexo + Github Pages
Sign in Github
If you already have a Github account, you can skip this part
- open https://github.com/
- Click the Sign up button in the upper right corner
Setup NodeJS Environment
Download NodeJS
You can download on NodeJs.
Config NodeJS
Consider disk space, it is necessary to move the npm package to another disk.
Run in terminal (after NodeJS installed)
1 |
|
You can check the current configuration of npm
1 |
|
Setup Git Environment
Download Git
For Windows, download on this.
For Linux, it builtin.
Config Git
1 |
|
Create local Hexo directory
Assuming that the local Hexo directory is located in D:/HexoBlog
Hexo init directory
1 |
|
If everything is fine, you will see the following structure
1 |
|
Install a theme for Hexo
select one theme on hexo-themes
Assuming that you choose A-Obsidian
You can go to the github repositoriy of the A-Obsidian theme at the end of the page
in this README.md, you need run following command to install theme
,also applicable to most other theme
1 |
|
then activate Theme
Open Hexo config file _config.yml, set theme to obsidian
1 |
|
install dependency files of theme-obsidian
1 |
|
now you can run following command to Local Testing.
1 |
|
Config remote server
Create a blog repository in Github
create a new public repository named <username>.github.io
a sample is Siltal.github.io
Generator a rsa key
1 |
|
now copy the text of C:\Users\UserName\.ssh\id_rsa.pub
go to the Settings of blog repository.
find Deploy keys,click Add deploy key
and paste text in here.
Config Hexo Deployment
Install Hexo-deployer-git
1 |
|
In _config.yml
1 |
|
Generator static files.
1 |
|
Final step,Deploy to remote sites
1 |
|
$$
Done.
$$