Build the Environment
- Install node. js: http://nodejs.org/en
- Install Git: Https://github.com/waylau/git-for-win
- Set git: Open directly
Git Bash
or from 开始
Git Bash
. Enter the following code, respectively:
git config --global user.name "yourname"
git config --global user.email "[email protected]"
Pay attention to replacing it with your own.
- Install Hexo: In the
Git Bash
input
npm install -g hexo-cli
npm install -g
-g
The meaning is global installation.
Here you need to wait for one end of time. The $ indicated does not appear to be downloading the installation.
Configure coding or GitHub (here coding for example) to create a warehouse
Join key
Git Bash
Input in:
ssh-keygen -t rsa -C "Coding或Github的注册邮箱地址"
will appear a few choice operation, do not understand the default, all the way to the return.
The computer directory C:\Users\你的用户名
found the .ssh
directory (no View hidden folder), enter, copy the id_rsa.pub
content.
It is recommended to use notepad
Open text.
Copy to 2. Internal
Initialize Blog
- Create your own folders locally.
- In the Files folder, Right-click to select
Git Bash
Input:
hexo init blog
Success will prompt:! NFO Start Blogging with hexo!
- Local preview
First confirm whether under the blog
directory, if not, enter:
cd blog
$ hexo generate# 启动本地服务器$ hexo server# 在浏览器输入 http://localhost:4000/就可以看见网页和模板了INFO Start processingINFO Hexo is running at http://localhost:4000/. Press Ctrl+C to stop.
Open in Browser: localhost:4000
Configure Blog
In the blog
directory, sublime/notepad++
open the configuration parameters with an equal text editor _config.yml
.
It is important to note that after each parameter :
there is a space.
Modify site Information
title: 标题subtitle: 副标题description: 网页描述author: 作者language: zh-CNtimezone: Asia/Shanghai
Configuring Deployment Information
deploy: type: git repo: [email protected]:StarryTree/Hexo.git branch: master
repo:
The content can be found on the coding or GitHub warehouse code page.
Configure Uniform Resource Locator
# URL## If your site is put in a subdirectory, set url as ‘http://yoursite.com/child‘ and root as ‘/child/‘url: https://starrytree.cnroot: /permalink: :year/:month/:day/:title/permalink_defaults:
If you have a personal domain name can be set, otherwise skip. If it is a Github.io URL, you can also fill in.
root
other information, such as (root directory), permalink
(permalink), permalink_defaults
(default permalink), remains the default.
Because coding is assigned a directory, it is required root: 项目名称
.
Published articles
- New blog post:
Git Bash
Input below:
hexo new "文章名称"
INFO created:c:\1\document\git\hexo\blog\source_posts\test.md
- Open the file as prompted.
The editor needs to use the markdown syntax. Markdown Syntax Instructions (Simplified Chinese version)
Recommended Header documents:
---title: title #文章标题date: 2017-09-08 23:47:44 #文章生成时间categories: "Hexo教程" #文章分类目录 可以省略tags: #文章标签 可以省略 - 标签1 - 标签2 description: #你对本页的描述 可以省略---
- Then in the blog directory, enter the following series (three) command:
F:\test\blog$ hexo cleanINFO Deleted database.INFO Deleted public folder.$ hexo generateINFO Start processingINFO Files loaded in 1.48 s#省略INFO 29 files generated in 4.27 s$ hexo serverINFO Start processingINFO Hexo is running at http://localhost:4000/. Press Ctrl+C to stop.
Local preview: http://127.0.0.1:4000
- Publish to the remote repository. Execution
hexo deploy
:
F:\test\blog$ hexo deployINFO Deploying: gitINFO Clearing .deploy_git folder...INFO Copying files from public folder...#省略
PostScript Supplement
The first push may require:
After the first push, please open the page service on the Coding code page.
Hexo Free Blog (WIN)