This article aims to look at my record by Hexo build a blog, and deploy Github above process, but also for myself to start learning and reference in the future use. Need to see more detail or official document can click Hexo official document to view it.
Hexo installation is very simple. Require pre-installed:
After preparing the conditions well you can start the installation Hexo
Open Git Bash Run
$ Npm install -g hexo-cli
Create a blog
Hexo After installation is complete, run the following commands respectively, Hexo will automatically generate the desired folder
$ Hexo init file address ## specified for you
$ Npm install
For example: the need to build a blog in the local D: \ under my_hexo, respectively, execute the command: hexo init D: \ my_hexo, cd D: \ my_hexo, npm install
After executing the command, if there is no problem we can start to execute commands to see our blog a.
$ Hexo server ## to start the service, the default port 4000
$ Hexo server -p xxxx ## custom port to start the service
$ Hexo clean ## clear the cache, the page is not displayed correctly when you can execute this command
Then enter in the browser to access http://127.0.0.1:4000/
Login github top right, click "+", Create a new repository
Create a new repository
Copy just the new https connection: https: //github.com/Admol/admol.github.io.git
Open _config.yml you hexo directory
Setting deploy information, such as:
Setting SSH key
Verify that the key exists
And then execute the command ls have been key to view the file, there is generally key words are displayed id_rsa.pub and id_dsa.pub these two documents, nothing will show no key
Add a SSH key
Run (existing key can skip step 2):
$ Ssh-keygen -t rsa -C "firstname.lastname@example.org"
## T specify the key type, the default is rsa, it can be omitted. -C Comment text settings, such as a mailbox or other.
You will be prompted Enter Enter file in which to save the key (/c/Users/you/.ssh/id_rsa): [Press enter, here is enter a file name to save the ssh key, nothing may be lost, We will use the default id_rsa.pub and id_dsa.pub
After a carriage return, you need to enter the password twice (this password is time you push the file to enter the password, instead github password)
After entering the password, see the following information is displayed, add SSH key success.
Github set SSH key
Login github, click Settings, then click on the SSH keys, on this page you can manage all your ssh keys
Then click on the Add SSH key
Open just added key id_rsa.pub file with a text editor, copy all the contents inside
Back github page, copy and paste the contents of the page to just key in the corresponding text box inside, title can easily fill
Test whether to add ssh key success
At the command line, enter:
$ Ssh -T email@example.com
There will be some warning code, enter yes Enter, and then will ask you to enter a password just set, then it will, and you say: Hi, handsome about it ....
This will set up the SSH key
Deployed to Github
Open a command window, back to your hexo blog directory, such as do not execute the following command:
Wait command is finished, you can see if the code has been submitted to the github, then enter admol.github.io browser can access the
$ Hexo new page 'pageName'
After executing the command that you can see the new page file name is the name of the folder in your local / source directory
After opening the file can be edited index.md. _config.yml Then open the file (topics that are being used) / themes / jacman directory,
Just add the new page:
Statistics: / archives
About: / about
pageName: / pageName ## pageName can customize the front, just behind the pageName must write the name of the new page
$ Hexo new [layout] 'name'
[Layout] is optional, the default is not written post. / File source directory folder name is the name of the layout
$ Git clone https://github.com/JamesPan/hexo-theme-icarus.git themes / icarus
First, download the theme, and then open the _cinfig.yml root directory, modify the theme: To replace the topic name
Modify theme colors
Open _config.yml file / themes / jacman directory, Review:
theme: 'color value'
Modify logo image
Open _config.yml file topic under Review:
enable: false ## whether to display the logo
src: img / logo.gif ## logo image address
favicon: img / qq.ico ## icon in the top left of the page
Upgrade version Hexo
$ Npm update hexo -g