Yuchao's Blog

How to create a Hexo post

2019-03-01

Overview

This is my personal blog. It consists from three git repositories.

  1. My customized theme my-vevx which is based on hexo-theme-vexo. It is a git submodule of hexo-blog.
  2. hexo-blog contains the hexo and blogs.
  3. yuchaozh.github.io is the repo to host the blog at http://yuchaozh.github.io

Clone the hexo-blog project to local

1
git clone https://github.com/yuchaozh/hexo-blog.git

Install Hexo

1
npm install -g hexo-cli

Pull the theme sub-module

1
git submodule update --init

Init Hexo

go to the blog folder. e.g. C:\Users\v-yuczh\Documents\GitHub\hexo-blog

1
npm install

Create a new post

1
hexo new "XXXXXXX"

Turn up local server

1
hexo server

You can view your website locally at http://localhost:4000, you can check your new post locally.

Deploy to prod

1
hexo deploy

Commit the changes to git

1
2
3
git add
git commit -m ""
git push

Or Use hexo-deployer-git

1
npm install hexo-deployer-git --save
1
hexo clean && hexo deploy 

you have to use clean && deploy together. hexo deploy is not working anymore.
to deploy and commit to git at the same time. However, this will commit to https://github.com/yuchaozh/yuchaozh.github.io project, not the hexo-blog project. So you still need to commit to hexo-blog afater use the above command.

Tags: Hexo
使用支付宝打赏
使用微信打赏

若你觉得我的文章对你有帮助,欢迎点击上方按钮对我打赏

扫描二维码,分享此文章