用 Hugo 寫文章並透過 GitHub Actions 部署到 GitHub Pages

前言 這個部落格跑了一段時間,但我一直沒有好好整理它是怎麼運作的。趁現在記錄一下:本地怎麼新增文章、推上 GitHub 後又發生了什麼事,讓網站自動更新。 專案結構 整個 GitHub repository(arieshsieh0402.github.io)的結構如下: arieshsieh0402.github.io/ ← git repo 根目錄 ├── .github/ │ └── workflows/ │ └── hugo.yaml ← GitHub Actions 部署設定 ├── AriesHsieh/ ← Hugo 專案目錄 │ ├── archetypes/ │ │ └── posts.md ← 新文章的預設模板 │ ├── content/ │ │ └── posts/ ← 所有文章放這裡 │ ├── themes/ │ │ └── PaperMod/ ← 使用的 Hugo 主題 │ ├── public/ ← hugo build 產生的靜態檔案(不進 git) │ └── hugo.yaml ← Hugo 網站設定 Hugo 專案本身放在 repo 根目錄下的 AriesHsieh/ 子目錄,而非 repo 根目錄。這個結構在 GitHub Actions 設定中需要特別注意 working directory。 ...

March 8, 2026 · 2 分鐘