Hexo 提供了快速方便的一鍵部署功能,讓您只需一條命令就能將網(wǎng)站部署到服務(wù)器上。
$ hexo deploy
在開始之前,您必須先在 _config.yml 中修改參數(shù),一個正確的部署配置中至少要有 type 參數(shù),例如:
deploy:
type: git
您可同時使用多個 deployer,Hexo 會依照順序執(zhí)行每個 deployer。
deploy:
- type: git
repo:
- type: heroku
repo:
$ npm install hexo-deployer-git --save
修改配置。
deploy:
type: git
repo:
branch: [branch]
message: [message]
| 參數(shù) | 描述 |
|---|---|
repo |
庫(Repository)地址 |
branch |
分支名稱。如果您使用的是 GitHub 或 GitCafe 的話,程序會嘗試自動檢測。 |
message |
自定提交信息 (默認(rèn)為 Site updated: {{ now("YYYY-MM-DD HH:mm:ss") }}) |
$ npm install hexo-deployer-heroku --save
修改配置。
deploy:
type: heroku
repo:
message: [message]
| 參數(shù) | 描述 |
|---|---|
repo |
Heroku 庫(Repository)地址 |
message |
自定提交信息 (默認(rèn)為 Site updated: {{ now("YYYY-MM-DD HH:mm:ss") }}) |
$ npm install hexo-deployer-rsync --save
修改配置。
deploy:
type: rsync
host:
user:
root:
port: [port]
delete: [true|false]
verbose: [true|false]
ignore_errors: [true|false]
| 參數(shù) | 描述 | 默認(rèn)值 |
|---|---|---|
host |
遠(yuǎn)程主機的地址 | |
user |
使用者名稱 | |
root |
遠(yuǎn)程主機的根目錄 | |
port |
端口 | 22 |
delete |
刪除遠(yuǎn)程主機上的舊文件 | true |
verbose |
顯示調(diào)試信息 | true |
ignore_errors |
忽略錯誤 | false |
$ npm install hexo-deployer-openshift --save
修改配置。
deploy:
type: openshift
repo:
message: [message]
| 參數(shù) | 描述 |
|---|---|
repo |
OpenShift 庫(Repository)地址 |
message |
自定提交信息 (默認(rèn)為 Site updated: {{ now("YYYY-MM-DD HH:mm:ss") }}) |
$ npm install hexo-deployer-ftpsync --save
修改配置。
deploy:
type: ftpsync
host:
user:
pass:
remote: [remote]
port: [port]
ignore: [ignore]
connections: [connections]
verbose: [true|false]
| 參數(shù) | 描述 | 默認(rèn)值 |
|---|---|---|
host |
遠(yuǎn)程主機的地址 | |
user |
使用者名稱 | |
pass |
密碼 | |
remote |
遠(yuǎn)程主機的根目錄 | / |
port |
端口 | 21 |
ignore |
忽略的文件或目錄 | |
connections |
使用的連接數(shù) | 1 |
verbose |
顯示調(diào)試信息 | false |
Hexo 生成的所有文件都放在 public 文件夾中,您可以將它們復(fù)制到您喜歡的地方。