<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Github on 博客主页</title>
    <link>https://jaxon.ccwu.cc/tags/github/</link>
    <description>Recent content in Github on 博客主页</description>
    <generator>Hugo</generator>
    <language>zh</language>
    <lastBuildDate>Tue, 28 Apr 2026 08:00:00 +0800</lastBuildDate>
    <atom:link href="https://jaxon.ccwu.cc/tags/github/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>免服务器 Hugo &#43; Github &#43; Cloudflare 个人网站（静态网页）部署</title>
      <link>https://jaxon.ccwu.cc/posts/hogo/</link>
      <pubDate>Tue, 28 Apr 2026 08:00:00 +0800</pubDate>
      <guid>https://jaxon.ccwu.cc/posts/hogo/</guid>
      <description>&lt;h4 id=&#34;摘要&#34;&gt;&#xA;  摘要&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#%e6%91%98%e8%a6%81&#34;&gt;&#xA;    &lt;i class=&#34;fa-solid fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;Link to heading&#34;&gt;&lt;/i&gt;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;Link to heading&lt;/span&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h4&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;本地 hugo 搭建静态页面&lt;/li&gt;&#xA;&lt;li&gt;上传至 github 托管&lt;/li&gt;&#xA;&lt;li&gt;部署至 cloudflare page 或 cloudflare worker&lt;/li&gt;&#xA;&lt;li&gt;（可选）自定义网页域名&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h4 id=&#34;前置条件&#34;&gt;&#xA;  前置条件&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#%e5%89%8d%e7%bd%ae%e6%9d%a1%e4%bb%b6&#34;&gt;&#xA;    &lt;i class=&#34;fa-solid fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;Link to heading&#34;&gt;&lt;/i&gt;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;Link to heading&lt;/span&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h4&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Git&lt;/li&gt;&#xA;&lt;li&gt;已有 Github、Cloudflare 账号&lt;/li&gt;&#xA;&lt;li&gt;科学上网&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h4 id=&#34;一本地搭建静态页面&#34;&gt;&#xA;  一、本地搭建静态页面&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#%e4%b8%80%e6%9c%ac%e5%9c%b0%e6%90%ad%e5%bb%ba%e9%9d%99%e6%80%81%e9%a1%b5%e9%9d%a2&#34;&gt;&#xA;    &lt;i class=&#34;fa-solid fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;Link to heading&#34;&gt;&lt;/i&gt;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;Link to heading&lt;/span&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h4&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;安装 hugo：winget &lt;font style=&#34;color:rgb(0, 81, 194);&#34;&gt;install&lt;/font&gt; Hugo.Hugo.Extended&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;手动安装：&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/gohugoio/hugo/releases/download/v0.157.0/hugo_extended_0.157.0_windows-amd64.zip&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://github.com/gohugoio/hugo/releases/download/v0.157.0/hugo_extended_0.157.0_windows-amd64.zip&lt;/a&gt;，解压到合适位置，把解压后的 hugo.exe 所在路径添加到环境变量 path，用 hugo version 验证&lt;/p&gt;&lt;/blockquote&gt;&#xA;&lt;ol start=&#34;2&#34;&gt;&#xA;&lt;li&gt;创建 hugo 项目：hugo new site pblog&lt;/li&gt;&#xA;&lt;li&gt;进入项目：cd pblog&lt;/li&gt;&#xA;&lt;li&gt;复制主题：git clone &lt;a href=&#34;https://github.com/luizdepra/hugo-coder.git&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://github.com/luizdepra/hugo-coder.git&lt;/a&gt; themes/hugo-coder&lt;/li&gt;&#xA;&lt;li&gt;配置 hugo.toml，可以使用主题作者提供的示例&lt;/li&gt;&#xA;&lt;li&gt;启动本地预览：hugo server 默认在  &lt;a href=&#34;http://localhost:1313/&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;http://localhost:1313/&lt;/a&gt; 查看&lt;/li&gt;&#xA;&lt;li&gt;删掉主题库 .git：rmdir /s /q themes\hugo-coder.git，避免影响后续推送&lt;/li&gt;&#xA;&lt;li&gt;运行 hugo 验证是否可以成功构建：hugo&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h4 id=&#34;二托管至-github&#34;&gt;&#xA;  二、托管至 Github&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#%e4%ba%8c%e6%89%98%e7%ae%a1%e8%87%b3-github&#34;&gt;&#xA;    &lt;i class=&#34;fa-solid fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;Link to heading&#34;&gt;&lt;/i&gt;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;Link to heading&lt;/span&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h4&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;git init&lt;/li&gt;&#xA;&lt;li&gt;git add .&lt;/li&gt;&#xA;&lt;li&gt;git commit -m &amp;ldquo;Initial&amp;rdquo;&lt;/li&gt;&#xA;&lt;li&gt;在 Github 上创建一个仓库，可以是私有仓库，设置本地项目 Git 远程地址到仓库：git remote add origin &lt;a href=&#34;https://github.com/AlightSoulmate/hugo-demo.git&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://github.com/&lt;your-name&gt;/&lt;your-repo&gt;.git&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;git push -u origin master 或 git push -u origin main&lt;/li&gt;&#xA;&lt;li&gt;到仓库验证本地代码已推送&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h4 id=&#34;三部署至-cloudflare-pages&#34;&gt;&#xA;  三、部署至 Cloudflare Pages&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#%e4%b8%89%e9%83%a8%e7%bd%b2%e8%87%b3-cloudflare-pages&#34;&gt;&#xA;    &lt;i class=&#34;fa-solid fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;Link to heading&#34;&gt;&lt;/i&gt;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;Link to heading&lt;/span&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h4&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;进入 Cloudflare - 构建 - Compute - Workers 和 Pages 页面，点击创建应用程序，选择 Pages。首次使用时，需要绑定和授权 Github 账号&lt;/li&gt;&#xA;&lt;li&gt;在创建应用程序页面，选择要部署的项目对应仓库，选择静态框架为 hugo，快速部署，完成后使用 Cloudflare Pages 提供的默认域名访问网页&lt;/li&gt;&#xA;&lt;li&gt;如构建失败，可能是 Hugo 版本差异，需要指定 HUGO_VERSION  环境变量&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h4 id=&#34;四自定义域名&#34;&gt;&#xA;  四、自定义域名&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#%e5%9b%9b%e8%87%aa%e5%ae%9a%e4%b9%89%e5%9f%9f%e5%90%8d&#34;&gt;&#xA;    &lt;i class=&#34;fa-solid fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;Link to heading&#34;&gt;&lt;/i&gt;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;Link to heading&lt;/span&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h4&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;在 Cloudflare 或阿里云等国内云服务商购买域名，（不要购买 .cn 域名）若在 Cloudflare 外购买，需要在 Cloudflare 域名页面添加域名，按照提示修改 DNS 服务器，添加 DNS 记录，为顶级域名和 www 子域名添加两个 CNAME 记录&lt;/li&gt;&#xA;&lt;li&gt;在 Workers 和 Pages 页面刚刚部署的项目页添加自定义域名，需要等待较长时间&lt;/li&gt;&#xA;&lt;/ol&gt;</description>
    </item>
  </channel>
</rss>
