Hexo: Setup
¶Getting Started
- Generate static files:
hexo g
.[1] - Start server:
hexo s
.[2] - Clone Cactus theme:
https://github.com/probberechts/hexo-theme-cactus
.[3]
¶Configuration
- Change homepage intro section:
./themes/cactus/layout/index.ejs
,./themes/cactus/languages/en.yml
. - Enable footnotes: markdown-it.[4]
- Serve images and/or other assets.[5]
- Disable show/hide menu on downscroll/upscroll in mobile view:
./themes/cactus/source/js/main.js
. - Full-text RSS by hexo-generator-feed.[6]
- Disable Cactus RSS function:
rss:
in./themes/cactus/_config.yml
.[7] - Install hexo-generator-feed and configure
./_config.yml
.
1
2
3
4
5
6
7
8
9
10
11
12feed:
type: atom
path: atom.xml
limit: 20
hub:
content: true
content_limit:
content_limit_delim:
order_by: -date
icon: icon.png
autodiscovery: true
template: - Disable Cactus RSS function:
- Change global fonts:
./themes/cactus/source/css/_variables.styl
.
¶Deployment
- Deploy to GitHub.[8]
FTPSync to Aliyun VS (virtual server).[9]- Initiate git push to Github.
1
2
3
4
5
6
7
8
9# hexo g
git init
git remote add origin https://github.com/<username>/<repo name>.git
touch .gitignore # echo .DS_Store, public >> .gitignore
git add .
git commit -m "<message>"
git push -u origin master - Initiate git-ftp push to Aliyun VS.
1
2
3
4
5
6
7
8
9
10
11
12
13
14# hexo g
cd public
git init
git config git-ftp.url ftp://<FTP URL>/htdocs
git config git-ftp.user <username>
git config git-ftp.password <password>
git add .
git commit -m "<message>"
git ftp init && git ftp push
cd ..- Automate by creating a zsh script:
#!/bin/zsh
,$ chmod u+x <scriptname>
.[10]
- Automate by creating a zsh script:
¶Customized Commands
- Push to GitHub:
git commit -m "<message>" && git push
. - Push to Aliyun VS:
./git-ftp.sh
.
「由于FTP协议的特征,每传送一个文件就需要一次握手,相对速度较慢。」
https://hexo.io/zh-cn/docs/one-command-deployment.html#FTPSync ↩︎