I’m very happy to re-create my Blog website in MacBook Pro, start it and I’m on my way……
Steps:
Install Node.js and Git, following https://hexo.io/docs, setup video is very clear and helpful;
Run command in terminal to check if Node.js and Git installed well:
1
2$ node -v % v.14.16.0
$ git version % git version 2.20.1 (Apple Git-117)Install Hexo: in mac, need to add sudo, and input your pwd
1
$ sudo npm install -g hexo-cli
Run command
hexo -v
to check current hexo version:get successful response: % hexo-cli: 4.2.0 …
Create a local folder as my local Blog repo:
1
2
3$ hexo init MyBlog % (base) Grace~ grace$
$ cd MyBlog % (base) Grace:MyBlog grace$
$ npm installGreat! It’s all set! Now start blogging!!
1
2$ hexo new page *** % create a folder
$ hexo new post "***" % create a postThe post is a markdown file (.md file), use a Editor to edit it
Run
Hexo server
to run blog website locally at http://localhost:4000Change Theme: download a theme you like (via git clone …), clone it to local repro: MyBlog/themes, then modify the theme’s name in _config.yml, Run:
1
2
3$ hexo clean
$ hexo generate
$ hexo serverThen view the updated blog at http://localhost:4000
Deploy your blog website via Github Pages
Install deployer command to deploy hexo blog to Github
1
$ npm install hexo-deployer-git --save
In the _config.yml, modify:
1
2
3
4deploy:
type: git
repo: https://github.com/GraceCS/gracecs.github.io
branch: masterConfig your user email and username for Git account:
1
2$ git config --global user.email "*****@gmail.com"
$ git config --global user.name "GraceCS"Update your blog and deploy it to Github by:
1
$ hexo d -g
Need to verify your username of Github and your password to confirm your identity.
When it shows “INFO Deploy done: git”, it tells you it’s all set!
You can browse your blog website on-line!