<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Github-Pages on Justmaker's KB</title><link>https://justmaker.github.io/tags/github-pages/</link><description>Recent content in Github-Pages on Justmaker's KB</description><generator>Hugo -- gohugo.io</generator><language>zh-tw</language><lastBuildDate>Sun, 06 Apr 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://justmaker.github.io/tags/github-pages/index.xml" rel="self" type="application/rss+xml"/><item><title>Hugo + GitHub Pages 建站踩坑紀錄</title><link>https://justmaker.github.io/post/devops/hugo-github-pages-pitfalls/</link><pubDate>Sun, 06 Apr 2025 00:00:00 +0000</pubDate><guid>https://justmaker.github.io/post/devops/hugo-github-pages-pitfalls/</guid><description>&lt;h2 id="前言">前言
&lt;/h2>&lt;p>建這個站的過程其實沒有想像中順利。這篇記錄我遇到的坑，希望能幫其他人省點時間。&lt;/p>
&lt;h2 id="坑-1hugo-版本不對">坑 1：Hugo 版本不對
&lt;/h2>&lt;h3 id="問題">問題
&lt;/h3>&lt;p>用 &lt;code>apt install hugo&lt;/code> 裝的版本太舊（0.68），很多新 theme 需要 0.110+。&lt;/p>
&lt;h3 id="解法">解法
&lt;/h3>&lt;p>直接從 GitHub Release 下載 extended 版：&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">wget https://github.com/gohugoio/hugo/releases/download/v0.147.0/hugo_extended_0.147.0_linux-amd64.deb
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo dpkg -i hugo_extended_0.147.0_linux-amd64.deb
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>&lt;strong>一定要用 extended 版&lt;/strong>，不然 SCSS 編譯會失敗。&lt;/p>
&lt;h2 id="坑-2github-actions-的-submodule">坑 2：GitHub Actions 的 submodule
&lt;/h2>&lt;h3 id="問題-1">問題
&lt;/h3>&lt;p>Theme 是用 &lt;code>git submodule add&lt;/code> 加的，但 GitHub Actions checkout 時預設不會 clone submodule，導致 build 時找不到 theme。&lt;/p>
&lt;h3 id="解法-1">解法
&lt;/h3>&lt;p>&lt;code>actions/checkout&lt;/code> 加上 &lt;code>submodules: recursive&lt;/code>：&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">- &lt;span class="nt">uses&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">actions/checkout@v4&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">with&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">submodules&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">recursive&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">fetch-depth&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="m">0&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h2 id="坑-3github-pages-source-設定">坑 3：GitHub Pages Source 設定
&lt;/h2>&lt;h3 id="問題-2">問題
&lt;/h3>&lt;p>Push 上去後 GitHub Pages 顯示 404。&lt;/p>
&lt;h3 id="解法-2">解法
&lt;/h3>&lt;p>到 repo &lt;strong>Settings → Pages → Build and deployment → Source&lt;/strong>，選 &lt;strong>GitHub Actions&lt;/strong>（不是 Deploy from a branch）。&lt;/p>
&lt;p>很多教學文寫的是舊版用法（gh-pages branch），現在推薦用 GitHub Actions。&lt;/p>
&lt;h2 id="坑-4baseurl-結尾斜線">坑 4：baseURL 結尾斜線
&lt;/h2>&lt;h3 id="問題-3">問題
&lt;/h3>&lt;p>&lt;code>baseURL&lt;/code> 沒加結尾 &lt;code>/&lt;/code>，導致部分資源路徑錯誤。&lt;/p>
&lt;h3 id="解法-3">解法
&lt;/h3>&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="c"># ✅ 正確&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">baseURL&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">https://justmaker.github.io/&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="c"># ❌ 錯誤&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">baseURL&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">https://justmaker.github.io&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h2 id="坑-5中文檔名和-url">坑 5：中文檔名和 URL
&lt;/h2>&lt;h3 id="問題-4">問題
&lt;/h3>&lt;p>中文標題預設會變成中文 URL（&lt;code>/post/我的文章/&lt;/code>），在某些環境下會出問題。&lt;/p>
&lt;h3 id="解法-4">解法
&lt;/h3>&lt;p>每篇文章都明確指定 &lt;code>slug&lt;/code>：&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nn">---&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">title&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="s2">&amp;#34;我的中文標題&amp;#34;&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nt">slug&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="l">my-english-slug&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="nn">---&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h2 id="坑-6搜尋功能不-work">坑 6：搜尋功能不 work
&lt;/h2>&lt;h3 id="問題-5">問題
&lt;/h3>&lt;p>Stack theme 的搜尋功能一直轉圈。&lt;/p>
&lt;h3 id="解法-5">解法
&lt;/h3>&lt;p>需要在 &lt;code>hugo.yaml&lt;/code> 的 &lt;code>outputs&lt;/code> 加上 &lt;code>JSON&lt;/code>：&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-yaml" data-lang="yaml">&lt;span class="line">&lt;span class="cl">&lt;span class="nt">outputs&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="nt">home&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="l">HTML&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="l">RSS&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>- &lt;span class="l">JSON &lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c"># ← 搜尋功能需要這個&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Stack theme 的搜尋是 client-side，靠 &lt;code>index.json&lt;/code> 做全文搜尋。&lt;/p>
&lt;h2 id="總結">總結
&lt;/h2>&lt;p>大部分坑都是設定問題，知道就很簡單，不知道要 debug 很久。希望這篇能幫到你。&lt;/p>
&lt;p>如果你也遇到其他坑，歡迎在下方留言分享 👇&lt;/p></description></item><item><title>為什麼我要建這個知識庫</title><link>https://justmaker.github.io/post/devops/hello-world/</link><pubDate>Tue, 01 Apr 2025 00:00:00 +0000</pubDate><guid>https://justmaker.github.io/post/devops/hello-world/</guid><description>&lt;h2 id="動機">動機
&lt;/h2>&lt;p>工作幾年下來，技術筆記散落在各處——Confluence 頁面、Discord thread、各種 markdown 檔案、甚至腦子裡。每次要找之前踩過的坑，得翻半天。&lt;/p>
&lt;p>是時候把這些東西整理成一個對外的知識庫了。&lt;/p>
&lt;h2 id="為什麼選-hugo--github-pages">為什麼選 Hugo + GitHub Pages？
&lt;/h2>&lt;p>考慮過幾個方案：&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>方案&lt;/th>
&lt;th>優點&lt;/th>
&lt;th>缺點&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>WordPress&lt;/td>
&lt;td>功能完整、外掛多&lt;/td>
&lt;td>需要主機、慢、維護成本高&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Notion&lt;/td>
&lt;td>寫起來舒服&lt;/td>
&lt;td>SEO 差、客製化有限&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>Hexo&lt;/td>
&lt;td>靜態、Markdown&lt;/td>
&lt;td>Node.js 生態，build 慢&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Hugo&lt;/strong>&lt;/td>
&lt;td>&lt;strong>極快 build、Go 寫的、生態成熟&lt;/strong>&lt;/td>
&lt;td>模板語法學習曲線&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>最終選了 Hugo + GitHub Pages：&lt;/p>
&lt;ul>
&lt;li>&lt;strong>免費託管&lt;/strong>，不用管主機&lt;/li>
&lt;li>&lt;strong>Markdown 寫作&lt;/strong>，工程師友善&lt;/li>
&lt;li>&lt;strong>Build 速度極快&lt;/strong>，幾百篇文章也是秒 build&lt;/li>
&lt;li>&lt;strong>搭配 AI agent&lt;/strong> 可以批量產出內容&lt;/li>
&lt;li>&lt;strong>Git 版本控制&lt;/strong>，每篇文章的修改歷史一清二楚&lt;/li>
&lt;/ul>
&lt;h2 id="內容規劃">內容規劃
&lt;/h2>&lt;p>這個站會涵蓋我的主要興趣和工作領域：&lt;/p>
&lt;h3 id="-虛擬化技術">🖥️ 虛擬化技術
&lt;/h3>&lt;p>KVM、QEMU——這是我的主戰場。從架構設計到效能調校，踩過的坑多到可以寫一本書。&lt;/p>
&lt;h3 id="-ai-開發工具">🤖 AI 開發工具
&lt;/h3>&lt;p>OpenClaw、Claude、Copilot 的使用心得和實戰經驗。AI 輔助開發已經是我日常工作流的一部分。&lt;/p>
&lt;h3 id="-圍棋">⚫ 圍棋
&lt;/h3>&lt;p>業餘愛好，偶爾記錄覆盤心得和學習筆記。&lt;/p>
&lt;h3 id="-鋼琴">🎹 鋼琴
&lt;/h3>&lt;p>練琴心得和曲目紀錄。&lt;/p>
&lt;h3 id="-桌球">🏓 桌球
&lt;/h3>&lt;p>業餘打球的紀錄和技術筆記。&lt;/p>
&lt;h2 id="技術架構">技術架構
&lt;/h2>&lt;pre tabindex="0">&lt;code>Hugo (靜態網站產生器)
+ Stack theme (UI)
+ GitHub Pages (託管)
+ GitHub Actions (自動部署)
+ Giscus (留言系統)
+ OpenClaw (AI 輔助寫文)
&lt;/code>&lt;/pre>&lt;p>整個流程：寫 Markdown → push 到 GitHub → Actions 自動 build → 部署到 GitHub Pages。&lt;/p>
&lt;h2 id="接下來">接下來
&lt;/h2>&lt;p>先把幾篇核心文章寫出來，建立內容基底。然後慢慢養成定期發文的習慣。&lt;/p>
&lt;p>目標是每週 1-2 篇，有 AI 幫忙應該不難。&lt;/p>
&lt;p>敬請期待 🚀&lt;/p></description></item></channel></rss>