使用Hexo,建立blog(下)自定義主題
接續上一篇文章使用Hexo,建立blog(上)新增文章
push上github
先在github新增一個repository,命名邏輯為
1
2[github account].github.io
例:leahlin912.github.io複製該repository的網址(例:`git@github.com:leahlin912/leahlin912.github.io.git`)
用vscode(或其他編譯器)打開_config.yml檔案,並修改
# Deployment
的部分1
2
3
4
5
6# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
type: git
repository: git@github.com:leahlin912/leahlin912.github.io.git
branch: master安裝git
1
$ npm install hexo-deployer-git --save
輸入指令,將網站佈署到伺服器上
1
$ hexo deploy -g
設定repository的主題
在github的該repository頁面,進入「setting」
往下滑,點按「change theme」在瀏覽器中查看網址,成功!https://leahlin912.github.io/
若有檔案更新,則重複輸入指令
1
hexo deploy -g
更換主題
選擇要套用的主題
[Themes]
(https://hexo.io/themes/index.html)用vscode開啟blog資料夾,並進入
_config.yml
檔案中,修改主題theme(參考readme中開發者定義的theme名稱)因為檔案有更新,所以需要在terminal輸入指令
1
hexo deploy -g