Hexo 安裝筆記

Install Hexo

1
$ npm install -g hexo-cli

Repository

1
git clone https://github.com/GITPAGEUSERNAME/GITPAGEUSERNAME.github.io.git .deploy/GITPAGEUSERNAME.github.io

Shell Script

1
2
3
4
5
6
7
#!/bin/bash
hexo generate
cp -R public/* .deploy/codefuntw.github.io
cd .deploy/codefuntw.github.io
git add .
git commit -m “update”
git push origin master

Custom Domain Setting Reference

1
2
3
https://help.github.com/articles/setting-up-an-apex-domain/
https://help.github.com/articles/setting-up-an-apex-domain/#configuring-a-records-with-your-dns-provider
https://help.github.com/articles/adding-or-removing-a-custom-domain-for-your-github-pages-site/

Custom Domain 對應到 GitHub page

1
2
3
4
5
6
7
8
9
$ dig blog.codefun.tw +nostats +nocomments +nocmd

; <<>> DiG 9.8.3-P1 <<>> blog.codefun.tw +nostats +nocomments +nocmd
;; global options: +cmd
;blog.codefun.tw. IN A
blog.codefun.tw. 3599 IN CNAME GITPAGEUSERNAME.github.io.
GITPAGEUSERNAME.github.io. 3599 IN CNAME github.map.fastly.net.
github.map.fastly.net. 2865 IN CNAME prod.github.map.fastlylb.net.
prod.github.map.fastlylb.net. 13 IN A 151.101.100.133

Command

常用基本指令

1
2
3
4
5
$ hexo g  # 或者 hexo generate
$ hexo s # 或者 hexo server,可以在 http://localhost:4000/ 查看
$ hexo deploy (hexo d) # 部署到遠端
$ hexo new "postName" # 新建文章
$ hexo new page "pageName" # 新建頁面

常用簡寫

1
2
3
4
$ hexo n == hexo new
$ hexo g == hexo generate
$ hexo s == hexo server
$ hexo d == hexo deploy

常用組合

1
2
$ hexo d -g  # 生成部署
$ hexo s -g # 生成預覽

Plugins

1
2
$ npm install hexo-generator-feed
$ npm install hexo-generator-sitemap