{"slug":"fuwari","title":"Fuwari静态博客搭建教程","description":"Fuwari 是一个静态博客框架，配合 Cloudflare Pages 可以快速搭建一个轻量、安全且易维护的个人博客","coverImage":"https://b.acofork.com/img/fuwari-f286ef4d-326c-4c7c-8a1e-ed150937a12b.webp","coverWidth":1167,"coverHeight":919,"date":"2025-09-16","tags":["开发"],"pinned":false,"wordCount":2394,"html":"<h4 id=\"你需要准备的东西\">你需要准备的东西</h4><ol>\n<li><p>一点基础的折腾能力。遇到问题先自己排查，实在解决不了再搜索或借助 AI，这样搭建过程会顺利很多。</p>\n</li>\n<li><p><a href=\"https://git-scm.com/downloads\" target=\"_blank\" rel=\"noopener noreferrer\">Git - Downloads (git-scm.com)</a>：用于管理本地代码并与 GitHub 仓库同步。如果你更习惯图形界面，也可以尝试 <a href=\"https://github.com/apps/desktop\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub Desktop | Simple collaboration from your desktop</a>。</p>\n</li>\n<li><p><a href=\"https://nodejs.org/en\" target=\"_blank\" rel=\"noopener noreferrer\">Node.js — Run JavaScript Everywhere (nodejs.org)</a>：Fuwari 基于 Node.js，因此需要先安装它。</p>\n</li>\n<li><p>一个 <a href=\"https://github.com\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub</a> 账号：用于创建仓库并托管 Fuwari 项目文件。</p>\n</li>\n<li><p>一个 <a href=\"https://cloudflare.com\" target=\"_blank\" rel=\"noopener noreferrer\">Cloudflare</a> 账号：用于创建 Pages 项目并绑定域名。</p>\n</li>\n<li><p><a href=\"/posts/obsidian/\">黑曜石（Obsidian）</a>：这是一个可视化 Markdown 编辑器。由于 Fuwari 的文章和页面都以 Markdown 文件保存，准备一个顺手的编辑器会方便很多。</p>\n</li>\n<li><p>需要会一些基础的 Markdown 语法。如果暂时不熟悉，可以先看这个教程：<a href=\"https://markdown.com.cn/basic-syntax/\" target=\"_blank\" rel=\"noopener noreferrer\">Markdown 基本语法 | Markdown 官方教程</a>。</p>\n</li>\n</ol>\n<h4 id=\"流程图\">流程图</h4><p>本地部署Fuwari，编写文章 -&gt; 推送更改到远程Github仓库 -&gt; Cloudflare Pages检测到仓库更新自动构建新的网站静态文件 -&gt; 网站成功更改</p>\n<h4 id=\"让我们开始吧\">让我们开始吧</h4><h5 id=\"首先-在本地部署-fuwari\">首先，在本地部署 Fuwari</h5><ol>\n<li><p>Fork仓库：</p>\n<p><a href=\"https://github.com/saicaca/fuwari\" target=\"_blank\" rel=\"noopener noreferrer\">https://github.com/saicaca/fuwari</a></p>\n</li>\n<li><p>如果你不熟悉 Fork 仓库的流程，可以参考下面的图片教程。</p>\n</li>\n<li><p><img src=\"https://b.acofork.com/img/fuwari-2024-10-14-12-15-44-image.webp\" alt=\"\" width=\"2560\" height=\"1528\" loading=\"eager\" decoding=\"async\" /><img src=\"https://b.acofork.com/img/fuwari-2024-10-14-12-17-03-image.webp\" alt=\"\" width=\"2560\" height=\"1528\" loading=\"lazy\" decoding=\"async\" /></p>\n</li>\n<li><p>然后将仓库克隆到本地：<code>git clone &lt;你的仓库URL&gt;</code>。如果可以使用 SSH，后续推送通常会更方便。</p>\n</li>\n<li><p>先全局安装 <code>pnpm</code>：<code>npm install -g pnpm</code>。如果 npm 在国内下载较慢，可以尝试切换镜像源，例如 <a href=\"https://npmmirror.com/\" target=\"_blank\" rel=\"noopener noreferrer\">npmmirror 镜像站</a>。</p>\n</li>\n<li><p>接着在项目根目录安装依赖：<code>pnpm install</code> 和 <code>pnpm add sharp</code>。</p>\n</li>\n<li><p>完成以上步骤后，Fuwari 就已经成功部署到本地了。</p>\n</li>\n</ol>\n<aside class=\"markdown-alert markdown-alert--tip\"><div class=\"markdown-alert-title\"><svg class=\"markdown-alert-icon\" aria-hidden=\"true\" width=\"18\" height=\"18\" viewbox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5\"></path><path d=\"M9 18h6\"></path><path d=\"M10 22h4\"></path></svg><span>提示</span></div><div class=\"markdown-alert-body\"><p>你也可以使用创建一个新的空仓库然后手动上传文件，并且可以将仓库可见性设为：Private</p>\n</div></aside><h5 id=\"改写fuwari的基本信息并且清理多余文件\">改写Fuwari的基本信息并且清理多余文件</h5><blockquote>\n<p>刚创建的 Fuwari 可能带有默认的博主名称、图标、链接、简介和示例文章。为了让站点更符合你的使用场景，建议先把这些内容改成自己的信息。</p>\n</blockquote>\n<ol>\n<li><p>在根目录的 <code>src</code> 文件夹中找到 <code>config.ts</code>，这里是站点的核心配置文件。</p>\n<ul>\n<li><p>title：你的博客主标题</p>\n</li>\n<li><p>subtitle：你的博客副标题。可选，在首页会显示为“主标题 - 副标题”</p>\n</li>\n</ul>\n</li>\n</ol>\n<ul>\n<li><p>lang：博客显示语言。注释里已经列出了一些常见值，例如 <code>en</code>、<code>zh_CN</code>、<code>zh_TW</code>、<code>ja</code>、<code>ko</code></p>\n</li>\n<li><p>themeColor：<code>hue</code> 表示博客主题色。你可以先在博客右上角的调色板里挑选喜欢的颜色，再把数值写回配置中。<img src=\"https://b.acofork.com/img/fuwari-2024-10-15-09-16-30-image.webp\" alt=\"\" width=\"540\" height=\"264\" loading=\"lazy\" decoding=\"async\" /></p>\n</li>\n<li><p>banner：src：即banner图片，支持http/https URL</p>\n</li>\n<li><p>favicon：src：即网站图标，支持http/https URL</p>\n</li>\n<li><p>links：即友情链接，这些链接在导航栏上</p>\n</li>\n<li><p>avatar：你的头像</p>\n</li>\n<li><p>name：你的名字</p>\n</li>\n<li><p>bio：个性签名，会显示在头像和名字下方</p>\n</li>\n<li><p><code>NavBarConfig</code> 用于配置导航栏链接，<code>ProfileConfig</code> 用于配置个人资料区域的链接，效果如下图所示。<img src=\"https://b.acofork.com/img/fuwari-2024-10-15-17-49-30-image.webp\" alt=\"\" width=\"2025\" height=\"1356\" loading=\"lazy\" decoding=\"async\" /></p>\n</li>\n<li><p>icon：你可以前往 <a href=\"https://icones.js.org/\" target=\"_blank\" rel=\"noopener noreferrer\">icones.js</a> 搜索想要的图标。例如 QQ 可以填写 <code>fa6-brands:qq</code>。Fuwari 默认支持 <code>fa6-brands</code>、<code>fa6-regular</code>、<code>fa6-solid</code>、<code>material-symbols</code> 等类型，必要时也可以在 <code>astro.config.mjs</code> 中继续扩展。</p>\n</li>\n<li><p><img src=\"https://b.acofork.com/img/fuwari-1ef05530-10fd-4301-af4e-21ddadf18605.webp\" alt=\"\" width=\"555\" height=\"352\" loading=\"lazy\" decoding=\"async\" /></p>\n</li>\n<li><p><img src=\"https://b.acofork.com/img/fuwari-da94494b-cc4b-4f07-ae95-8bf3b2f95d3c.webp\" alt=\"\" width=\"209\" height=\"206\" loading=\"lazy\" decoding=\"async\" /></p>\n</li>\n<li><p>这里我附上我的 <code>config.ts</code> </p>\n</li>\n<li><div class=\"markdown-code\" data-language=\"ts\"><div class=\"markdown-code-header\"><span class=\"markdown-code-language\"><svg class=\"code-language-icon\" aria-hidden=\"true\" width=\"16\" height=\"16\" viewbox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1\"></path><path d=\"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 0-2-2V5a2 2 0 0 0-2-2h-1\"></path></svg><span>ts</span></span><button type=\"button\" class=\"code-block-copy\" aria-label=\"复制代码\" title=\"复制代码\"><svg class=\"code-block-copy-icon\" aria-hidden=\"true\" width=\"16\" height=\"16\" viewbox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\"><rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\"></rect><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"></path></svg></button></div><pre><code class=\"hljs language-ts\"><span class=\"hljs-keyword\">import</span> <span class=\"hljs-keyword\">type</span> {\n  <span class=\"hljs-title class_\">LicenseConfig</span>,\n  <span class=\"hljs-title class_\">NavBarConfig</span>,\n  <span class=\"hljs-title class_\">ProfileConfig</span>,\n  <span class=\"hljs-title class_\">SiteConfig</span>,\n} <span class=\"hljs-keyword\">from</span> <span class=\"hljs-string\">'./types/config'</span>\n<span class=\"hljs-keyword\">import</span> { <span class=\"hljs-title class_\">LinkPreset</span> } <span class=\"hljs-keyword\">from</span> <span class=\"hljs-string\">'./types/config'</span>\n\n<span class=\"hljs-keyword\">export</span> <span class=\"hljs-keyword\">const</span> <span class=\"hljs-attr\">siteConfig</span>: <span class=\"hljs-title class_\">SiteConfig</span> = {\n  <span class=\"hljs-attr\">title</span>: <span class=\"hljs-string\">'AcoFork Blog'</span>,\n  <span class=\"hljs-attr\">subtitle</span>: <span class=\"hljs-string\">'爱你所爱！'</span>,\n  <span class=\"hljs-attr\">lang</span>: <span class=\"hljs-string\">'zh_CN'</span>,         <span class=\"hljs-comment\">// 'en', 'zh_CN', 'zh_TW', 'ja', 'ko'</span>\n  <span class=\"hljs-attr\">themeColor</span>: {\n    <span class=\"hljs-attr\">hue</span>: <span class=\"hljs-number\">355</span>,         <span class=\"hljs-comment\">// Default hue for the theme color, from 0 to 360. e.g. red: 0, teal: 200, cyan: 250, pink: 345</span>\n    <span class=\"hljs-attr\">fixed</span>: <span class=\"hljs-literal\">false</span>,     <span class=\"hljs-comment\">// Hide the theme color picker for visitors</span>\n  },\n  <span class=\"hljs-attr\">banner</span>: {\n    <span class=\"hljs-attr\">enable</span>: <span class=\"hljs-literal\">true</span>,\n    <span class=\"hljs-attr\">src</span>: <span class=\"hljs-string\">'https://eo-r2.2x.nz/myblog/img/222.webp'</span>,   <span class=\"hljs-comment\">// Relative to the /src directory. Relative to the /public directory if it starts with '/'</span>\n    <span class=\"hljs-attr\">position</span>: <span class=\"hljs-string\">'center'</span>,      <span class=\"hljs-comment\">// Equivalent to object-position, only supports 'top', 'center', 'bottom'. 'center' by default</span>\n    <span class=\"hljs-attr\">credit</span>: {\n      <span class=\"hljs-attr\">enable</span>: <span class=\"hljs-literal\">false</span>,         <span class=\"hljs-comment\">// Display the credit text of the banner image</span>\n      <span class=\"hljs-attr\">text</span>: <span class=\"hljs-string\">''</span>,              <span class=\"hljs-comment\">// Credit text to be displayed</span>\n      <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">''</span>                <span class=\"hljs-comment\">// (Optional) URL link to the original artwork or artist's page</span>\n    }\n  },\n  <span class=\"hljs-attr\">favicon</span>: [    <span class=\"hljs-comment\">// Leave this array empty to use the default favicon</span>\n     {\n       <span class=\"hljs-attr\">src</span>: <span class=\"hljs-string\">'https://q2.qlogo.cn/headimg_dl?dst_uin=2973517380&amp;spec=5'</span>,    <span class=\"hljs-comment\">// Path of the favicon, relative to the /public directory</span>\n       <span class=\"hljs-comment\">//theme: 'light',              // (Optional) Either 'light' or 'dark', set only if you have different favicons for light and dark mode</span>\n       <span class=\"hljs-attr\">sizes</span>: <span class=\"hljs-string\">'128x128'</span>,              <span class=\"hljs-comment\">// (Optional) Size of the favicon, set only if you have favicons of different sizes</span>\n     }\n  ]\n}\n\n<span class=\"hljs-keyword\">export</span> <span class=\"hljs-keyword\">const</span> <span class=\"hljs-attr\">navBarConfig</span>: <span class=\"hljs-title class_\">NavBarConfig</span> = {\n  <span class=\"hljs-attr\">links</span>: [\n    <span class=\"hljs-title class_\">LinkPreset</span>.<span class=\"hljs-property\">Home</span>,\n    <span class=\"hljs-title class_\">LinkPreset</span>.<span class=\"hljs-property\">Archive</span>,\n    <span class=\"hljs-title class_\">LinkPreset</span>.<span class=\"hljs-property\">About</span>,\n    {\n      <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'随机图'</span>,\n      <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'https://pic.onani.cn'</span>,     <span class=\"hljs-comment\">// Internal links should not include the base path, as it is automatically added</span>\n      <span class=\"hljs-attr\">external</span>: <span class=\"hljs-literal\">true</span>,                               <span class=\"hljs-comment\">// Show an external link icon and will open in a new tab</span>\n    },\n    {\n      <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'GitHub'</span>,\n      <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'https://github.com/saicaca/fuwari'</span>,     <span class=\"hljs-comment\">// Internal links should not include the base path, as it is automatically added</span>\n      <span class=\"hljs-attr\">external</span>: <span class=\"hljs-literal\">true</span>,                               <span class=\"hljs-comment\">// Show an external link icon and will open in a new tab</span>\n    },\n  ],\n}\n\n<span class=\"hljs-keyword\">export</span> <span class=\"hljs-keyword\">const</span> <span class=\"hljs-attr\">profileConfig</span>: <span class=\"hljs-title class_\">ProfileConfig</span> = {\n  <span class=\"hljs-attr\">avatar</span>: <span class=\"hljs-string\">'https://eo-r2.2x.nz/myblog/img/111.webp'</span>,  <span class=\"hljs-comment\">// Relative to the /src directory. Relative to the /public directory if it starts with '/'</span>\n  <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'二叉树树'</span>,\n  <span class=\"hljs-attr\">bio</span>: <span class=\"hljs-string\">'Protect What You Love./爱你所爱！'</span>,\n  <span class=\"hljs-attr\">links</span>: [\n    <span class=\"hljs-comment\">// {</span>\n      <span class=\"hljs-comment\">// name: 'Twitter',</span>\n      <span class=\"hljs-comment\">// icon: 'fa6-brands:twitter',       // Visit https://icones.js.org/ for icon codes</span>\n                                        <span class=\"hljs-comment\">// You will need to install the corresponding icon set if it's not already included</span>\n                                        <span class=\"hljs-comment\">// `pnpm add @iconify-json/&lt;icon-set-name&gt;`</span>\n      <span class=\"hljs-comment\">// url: 'https://twitter.com',</span>\n    <span class=\"hljs-comment\">// },</span>\n    <span class=\"hljs-comment\">// {</span>\n      <span class=\"hljs-comment\">// name: 'Steam',</span>\n      <span class=\"hljs-comment\">// icon: 'fa6-brands:steam',</span>\n      <span class=\"hljs-comment\">// url: 'https://store.steampowered.com',</span>\n    <span class=\"hljs-comment\">// },</span>\n    {\n      <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'GitHub'</span>,\n      <span class=\"hljs-attr\">icon</span>: <span class=\"hljs-string\">'fa6-brands:github'</span>,\n      <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'https://github.com/afoim'</span>,\n    },\n    {\n      <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'QQ'</span>,\n      <span class=\"hljs-attr\">icon</span>: <span class=\"hljs-string\">'fa6-brands:qq'</span>,\n      <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'https://qm.qq.com/q/Uy9kmDXHYO'</span>,\n    },\n    {\n      <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'Email'</span>,\n      <span class=\"hljs-attr\">icon</span>: <span class=\"hljs-string\">'fa6-solid:envelope'</span>,\n      <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'mailto:email@example.com'</span>,\n    },\n  ],\n}\n\n<span class=\"hljs-keyword\">export</span> <span class=\"hljs-keyword\">const</span> <span class=\"hljs-attr\">licenseConfig</span>: <span class=\"hljs-title class_\">LicenseConfig</span> = {\n  <span class=\"hljs-attr\">enable</span>: <span class=\"hljs-literal\">true</span>,\n  <span class=\"hljs-attr\">name</span>: <span class=\"hljs-string\">'CC BY-NC-SA 4.0'</span>,\n  <span class=\"hljs-attr\">url</span>: <span class=\"hljs-string\">'https://creativecommons.org/licenses/by-nc-sa/4.0/'</span>,\n}</code></pre></div></li>\n</ul>\n<ol>\n<li><p>清理多余文件。根目录下的 <code>src/content/posts</code> 文件夹里会带有一些示例文章，这些内容主要用于演示 Markdown 语法和 Fuwari 的基本用法。你可以先备份到别处，再按需删除。</p>\n</li>\n<li><p>完成这些设置后，就可以开始撰写自己的文章了。</p>\n</li>\n</ol>\n<h4 id=\"让我们开始写作\">让我们开始写作！</h4><blockquote>\n<p>推荐使用 <a href=\"/posts/obsidian/\">黑曜石（Obsidian）</a></p>\n</blockquote>\n<ol>\n<li><p>首先，在项目根目录执行：<code>pnpm new-post &lt;这里填写你的文章标题&gt;</code></p>\n</li>\n<li><p>然后，在根目录下的 <code>src/content/posts</code> 文件夹中会多出一个 <code>xxx.md</code>文件</p>\n</li>\n<li><p>用 MarkText 打开这个文件后，你会看到一组基础元数据，其中有几项最需要关注。</p>\n</li>\n<li><div class=\"markdown-code\" data-language=\"markdown\"><div class=\"markdown-code-header\"><span class=\"markdown-code-language\"><svg class=\"code-language-icon\" aria-hidden=\"true\" width=\"16\" height=\"16\" viewbox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z\"></path><path d=\"M14 2v5a1 1 0 0 0 1 1h5\"></path><path d=\"M10 9H8\"></path><path d=\"M16 13H8\"></path><path d=\"M16 17H8\"></path></svg><span>markdown</span></span><button type=\"button\" class=\"code-block-copy\" aria-label=\"复制代码\" title=\"复制代码\"><svg class=\"code-block-copy-icon\" aria-hidden=\"true\" width=\"16\" height=\"16\" viewbox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\"><rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\"></rect><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"></path></svg></button></div><pre><code class=\"hljs language-markdown\">title: xxx\npublished: 2024-10-14\ndescription: ''\nimage: ''\ntags: []\ncategories: ''\ndraft: false \nlang: ''</code></pre></div><ul>\n<li><p>title：文章标题</p>\n</li>\n<li><p>published：文章创建时间</p>\n</li>\n<li><p>description：文章描述，正常会显示在文章标题下面</p>\n</li>\n<li><p>image：文章封面图（同目录需要写 <code>./</code> 如：<code>./https://eo-r2.2x.nz/myblog/img/2024-10-14-11-33-28-image.webp</code>）</p>\n</li>\n<li><p>tag：文章标签</p>\n</li>\n<li><p>categories：文章分类</p>\n</li>\n</ul>\n</li>\n<li><p>还需要修改根目录下的 <code>astro.config.mjs</code>，把其中的 <code>site:</code> 改成你自己的站点 URL，例如：<code>site: \"https://onani.cn\",</code>。</p>\n</li>\n<li><p>如果你想在 Markdown 文章里方便地插入图片，也可以顺手把编辑器配置好。</p>\n</li>\n<li><p>这并不复杂。借助 MarkText，可以像使用传统博客编辑器一样直接复制粘贴图片，不过需要先做一点简单配置：</p>\n</li>\n</ol>\n<ul>\n<li><p>依次点击 MarkText 左上角菜单 -&gt; <code>File</code> -&gt; <code>Preferences</code> -&gt; 左侧 <code>Image</code> 分类，然后按照下图进行设置。注意把第一个选项改成以 <code>Copy</code> 开头的模式，开启 <code>Prefer</code> 开关，并在上下两个文本框中分别填写绝对路径和相对路径。</p>\n</li>\n<li><p><img src=\"https://b.acofork.com/img/fuwari-2024-10-14-12-54-21-image.webp\" alt=\"\" width=\"1429\" height=\"979\" loading=\"lazy\" decoding=\"async\" /></p>\n</li>\n<li><p>这样一来，插入图片时就会先把图片复制到 <code>https://eo-r2.2x.nz/myblog/img</code> 对应的位置，再自动以 <code>![1](https://eo-r2.2x.nz/myblog/img/1.webp)</code> 这样的格式写入 Markdown 文件。你只需要复制粘贴，剩下的步骤 MarkText 会自动完成。</p>\n</li>\n</ul>\n<ol>\n<li>配置完成后，你就可以比较高效地用 MarkText 编写 Markdown 博文了。</li>\n</ol>\n<h5 id=\"本地预览-然后发布到github\">本地预览，然后发布到Github</h5><ol>\n<li><p>当你觉得文章写得差不多时，可以在项目根目录执行：<code>pnpm dev</code>。稍等片刻后，就能在本地预览博客效果。<img src=\"https://b.acofork.com/img/fuwari-2024-10-14-13-03-44-image.webp\" alt=\"\" width=\"826\" height=\"381\" loading=\"lazy\" decoding=\"async\" /></p>\n</li>\n<li><p>接下来就可以使用 Git 把这些改动发布到 GitHub。</p>\n</li>\n</ol>\n<ul>\n<li><p>首先，让 Git 知道你是谁：<code>git config --global user.name \"你的GitHub用户名\"</code> 和 <code>git config --global user.email \"你的GitHub邮箱@example.com\"</code></p>\n</li>\n<li><p>然后，将远程仓库地址改成 SSH 形式（如果你本来就是通过 SSH 克隆的，就不需要再修改）：<code>git remote set-url origin git@github.com:xxx/xxx</code></p>\n</li>\n<li><p>随后，提交所有变更：<code>git add .</code></p>\n</li>\n<li><p>接着，创建一次本地提交：<code>git commit -m \"项目初始化\"</code></p>\n</li>\n<li><p>最后，把本地更改推送到远程仓库：<code>git push</code></p>\n</li>\n</ul>\n<ol>\n<li>完成后，你的 GitHub 仓库里就应该能看到新的提交记录了。<img src=\"https://b.acofork.com/img/fuwari-2024-10-14-13-10-12-image.webp\" alt=\"\" width=\"1359\" height=\"97\" loading=\"lazy\" decoding=\"async\" /></li>\n</ol>\n<h5 id=\"让cloudflare连接上github-使用pages服务展示你的博客-free\">让Cloudflare连接上Github，使用Pages服务展示你的博客（FREE！）</h5><ol>\n<li><p>前往Cloudflare的 Workers 和 Pages 页面，创建一个新Pages<img src=\"https://b.acofork.com/img/fuwari-2024-10-14-13-14-28-image.webp\" alt=\"\" width=\"2560\" height=\"1528\" loading=\"lazy\" decoding=\"async\" /></p>\n</li>\n<li><p>然后选择连接Git存储库，连接你的Github，随后设置构建命令：<code>pnpm build</code>  ，然后设置构建输出目录：<code>dist</code> ，如图<img src=\"https://b.acofork.com/img/fuwari-2024-10-14-13-16-15-image.webp\" alt=\"\" width=\"1156\" height=\"612\" loading=\"lazy\" decoding=\"async\" /></p>\n</li>\n<li><p>绑定自定义域，访问自定义域即可访问你的博客！<img src=\"https://b.acofork.com/img/fuwari-2024-10-14-13-17-00-image.webp\" alt=\"\" width=\"2560\" height=\"1528\" loading=\"lazy\" decoding=\"async\" /></p>\n</li>\n<li><p>随后，你只需要在本地编写文章，然后<a href=\"#本地预览然后发布到github\">使用Git将更改推送到远程仓库</a>，Cloudflare就会自动部署，更新你的博客！</p>\n</li>\n</ol>\n","toc":[{"id":"你需要准备的东西","text":"你需要准备的东西","depth":4},{"id":"流程图","text":"流程图","depth":4},{"id":"让我们开始吧","text":"让我们开始吧","depth":4},{"id":"首先-在本地部署-fuwari","text":"首先，在本地部署 Fuwari","depth":5},{"id":"改写fuwari的基本信息并且清理多余文件","text":"改写Fuwari的基本信息并且清理多余文件","depth":5},{"id":"让我们开始写作","text":"让我们开始写作！","depth":4},{"id":"本地预览-然后发布到github","text":"本地预览，然后发布到Github","depth":5},{"id":"让cloudflare连接上github-使用pages服务展示你的博客-free","text":"让Cloudflare连接上Github，使用Pages服务展示你的博客（FREE！）","depth":5}]}