Hexo Migration
The following code is only tested on Apple Silicon.
Config Git
1
2
3
4
5git config user.name <your_name>
git config user.email <your@email.address>
git config -l # list git config
ssh-keygen -t rsa -C "your@email.address"
cat ~/.ssh/id_rsa.pubCopy rsa public key to GitHub->Settings->SSH and GPG keys.
Install Nodejs
In China, you may consider install cnpm
1
sudo npm install -g cnpm --registry=https://registry.npm.taobao.org
In the following steps, I will use
cnpm
, same fornpm
.
Install hexo with
npm
cnpm install -g hexo-cli
Install deployment plugin
cnpm install --save hexo-deployer-git
Install Homebrew
In China, you may consider
HomebrewCN
1
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
Math equation rendering
Install
pandoc
brew install pandoc
If
Error: Command failed with exit 128: git
1
2git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask
Uninstall
hexo-renderer-marked
npm uninstall hexo-renderer-marked --save
Install
hexo-renderer-pandoc
npm install hexo-renderer-pandoc
Support local search in Next theme
install plug-in
1
2npm install hexo-generator-search --save
npm install hexo-generator-searchdb --saveset local search to true in Next config file
1
2local_search:
enable: true
Done! 🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉🎉
hexo clean; hexo g; hexo d
Here is two shell scripts for you
blog.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16!/bin/zsh
read input
name=$''
filename=$''
for arg in "$*"
do
name=$s$arg
done
create new post
hexo n "$name"
open post
name=$(echo $name|sed "s/ /-/g") # replace space with short dash
open $'./source/_posts/'$name$'.md' # open markdown file
deploy.sh
1
2
3
4
5
6
7!/bin/zsh
hexo clean
hexo g
hexo clean
hexo d
clear
echo "Blog depolyment done! Let's post more! 🎉🎉🎉"