Windows:
Download and install Node.js from its offical website.
Install Hexo
Hexo is a fast, simple & powerful blog framework, powered by Node.js. Hexo can be installed easily by npm:
1
npm install hexo-cli -g
npm will be installed automaticallly while Node.js being installed.
Build the blog
Create a workspace
Workspace is an important folder where all your blog files are saved.
1 2
mkdir personal_web cd personal_web
Initialzie the blog
New blog
1 2
hexo init npm install
Existing blog
1 2
git clone https://path.to.your.git npm install
Local debugging
1 2 3
hexo clean # clean the workspace, delete database and the public folder hexo g(generate) hexo s(serve)
After executing the command hexo s, we could open the local website through the browser by entering lcoalhost:4000.
Deploy
Hexo provides a fast and convenient one-click deployment function, allowing you to deploy your website to the server with just one command. Before using the deploy command, _config.yml is required to modified. Use Github platform as an example:
After modifying _config.yml, use the following commands to deploy your personal website to Github platform:
1 2
hexo clean # if something wrong happens to your website hexo g -d
Tricks
The server and repository of npm are overseas, hence some unforeseen problems may occur while executing the command npm install because of unstable Internet connection. In order to resolve the problem, we could reset the proxy of npm or use domestic registry.
reset the proxy
1 2
npm config set proxy 127.0.0.1:port npm config set https-proxy 127.0.0.1:port
use domestic registry
1
npm config set registry https://registry.npm.taobao.org