<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Cloudflare R2 on Wayne X.Y. Blog</title>
    <link>/tags/cloudflare-r2/</link>
    <description>Recent content in Cloudflare R2 on Wayne X.Y. Blog</description>
    <generator>Hugo</generator>
    <language>zh-TW</language>
    <lastBuildDate>Tue, 03 Feb 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="/tags/cloudflare-r2/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Hugo 圖片管理比較：GitHub vs Cloudflare R2</title>
      <link>/zh/2026/02/03/storing-asset/</link>
      <pubDate>Tue, 03 Feb 2026 00:00:00 +0000</pubDate>
      <guid>/zh/2026/02/03/storing-asset/</guid>
      <description>&lt;h1 id=&#34;hugo-圖片管理比較github-vs-cloudflare-r2&#34;&gt;Hugo 圖片管理比較：GitHub vs Cloudflare R2&lt;/h1&gt;&#xA;&lt;p&gt;&lt;a href=&#34;/zh/2026/02/01/setup-hugo-blog/&#34;&gt;在架設 Hugo 部落格後&lt;/a&gt;，也註冊了自己的網域，便開始開心的透過 &lt;code&gt;git push&lt;/code&gt; 更新網站。但稍微看了 repository 存放的內容，想想卻覺得圖片一起 push 好像怪怪的XD。之後如果持續更新維護，圖片勢必會增加，到時候會佔用太多空間。而且假如換個開發環境，在 pull 下來時，就要重新下載一堆圖片在 local。&lt;/p&gt;&#xA;&lt;p&gt;決定稍微研究一下，並比較原本 GitHub page 的做法，以及目前透過 Cloudflare R2 的做法。&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;原存放在-static-資料夾與網站同步部署&#34;&gt;原：存放在 static/ 資料夾（與網站同步部署）&lt;/h2&gt;&#xA;&lt;p&gt;這是 Hugo 的傳統標準作法，圖片會隨著你的程式碼一起推送到 GitHub。&lt;/p&gt;&#xA;&lt;h3 id=&#34;1-運作原理&#34;&gt;1. 運作原理&lt;/h3&gt;&#xA;&lt;p&gt;Hugo 會將 &lt;code&gt;static/&lt;/code&gt; 資料夾內的所有內容，在編譯時原封不動地搬移到網站根目錄。&lt;/p&gt;&#xA;&lt;h3 id=&#34;2-實作方式&#34;&gt;2. 實作方式&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;檔案路徑&lt;/strong&gt;：將圖片放在 &lt;code&gt;/static/images/test.jpg&lt;/code&gt;。&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Markdown 語法&lt;/strong&gt;：&#xA;&lt;code&gt;![圖片描述](/images/test.jpg)&lt;/code&gt; （路徑開頭的 &lt;code&gt;/&lt;/code&gt; 代表網站根目錄）。&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;3-優缺點分析&#34;&gt;3. 優缺點分析&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;優點&lt;/strong&gt;：&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;離線寫作&lt;/strong&gt;：不需要網路就能預覽圖片，圖片與文章內容生命週期一致。&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;版本控制&lt;/strong&gt;：圖片的異動也會紀錄在 Git 歷史中。&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;缺點&lt;/strong&gt;：&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;儲存庫肥大&lt;/strong&gt;：隨著圖片增加，GitHub Repository 的體積會迅速增長，長期下來會影響效能。&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;hr&gt;&#xA;&lt;h2 id=&#34;現使用-cloudflare-r2&#34;&gt;現：使用 Cloudflare R2&lt;/h2&gt;&#xA;&lt;p&gt;為了避免 GitHub 儲存庫容量被圖片佔用太多，決定使用 Cloudflare R2，並且提供了 10GB 免費儲存空間，以目前來說非常足夠。&lt;/p&gt;&#xA;&lt;p&gt;⚠️ 注意：雖然說有免費額度，但還是需要先填寫付款資訊才能啟用。&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
