Hexo 部屬記錄

✅ 懶人包

1
2
3
npm install hexo-deployer-git --save
hexo clean
hexo deploy -g

使用 hexo-deployer-git 時:不需要再手動 git add / commit / push

前置作業

Docs: https://hexo.io/docs/one-command-deployment

假設 repo 已建立完成:

1️⃣ 設定 _config.yml

1
2
3
4
deploy:
type: git
repo: https://github.com/username/username.github.io.git
branch: main

2️⃣ 安裝 deploy 套件(只需一次)

1
npm install hexo-deployer-git --save

正確部屬流程(已安裝 hexo-deployer-git)

1
2
hexo clean
hexo deploy -g

Hexo 會自動:

  1. 產生 public
  2. 建立 / 更新 .deploy_git
  3. 自動 commit
  4. 自動 push

⚠️ 不要再手動 git 操作 Pages repo

GitHub Pages 會先 build,因此會看到:

Checks → Pending

等待一段時間後會變成:

✔ Success

確認 deploy

查看:Repo → ActionsRepo → Settings → Pages
是否顯示 Deployment successful

若未使用 hexo-deployer-git(純手動)

1
2
hexo clean
hexo generate

會產生 public 目錄。

將 public 內容複製到 Pages repo 後:

1
2
3
4
git status
git add .
git commit -m "Deploy"
git push --force
舊流程(錯誤但偶爾可行)
1
2
3
4
5
6
7
npm install hexo-deployer-git --save
hexo clean
hexo deploy -g
git add .
git commit -m "update"
git pull
git push

1️⃣ 同時操作兩個 repo:

  • hexo deploy.deploy_git
  • 手動 git → 外層 repo

2️⃣ hexo deploy 預設會 force push 改寫遠端歷史
手動 git pull 容易產生衝突

Hexo 測試

這裡是用來測試 Hexo 的程式碼出來的效果用的。

本站大部分內容均參考至:


在撰寫時會需要測試markdown的輸出結果,可以去


基本上一般的 Html 也可以用,但跟 Markdown 混用可能會發生問題。

本篇也不算正式的教學,參考就好,東西太多我會分篇。

Butterfly

內容參考Butterfly

嘿嘿

display

content

Any content (support inline tags too.io).

content

info 提示塊標籤

success 提示塊標籤


如需要用圖示,可以去Icon


This is Tab 1.

This is Tab 2.

This is Tab 3.

只有圖標 沒有Tab名字



測試 hexo 張貼 youtube 影片連結(需有影片ID -> 分享 -> 網址後面一串英文):

Hexo docs.

Block

這裡是從 Hexo 擷取 ,更多資源可以去該網看看。

content

Do not just seek happiness for yourself. Seek happiness for all. Through kindness. Through mercy.

David LevithanWide Awake

NEW: DevDocs now comes with syntax highlighting. http://devdocs.io

Every interaction is both precious and an opportunity to delight.

Array.map
1
array.map(callback[, thisArg])

Others

HTML & CSS

Reference: 參考網址

info
primary
warning
danger
self-defined color

css 背景測試:

這是一個測試文本

Reference: 參考網址

格式是這樣:

1
<font color= "(顏色hex編碼, e.x. #008000)" > Color you want </font>

顏色編碼可以去這裡

輸出類似 Color you want


表格:

Column 1 Column 2 Column 3
Text1 Text2 Text3
Text4 Text5 Text6