视频加载失败

Fuwari静态博客搭建教程

2114 字
11 分钟
Fuwari静态博客搭建教程
Fuwari静态博客搭建教程

你需要准备的东西#

  1. 一个牛逼的脑子,支持并行运算至少两个单位以上的事件。遇到问题先思考,想不通就搜索,搜索不到就去和AI调情,不要上来就问问问

  2. Git - Downloads (git-scm.com):最牛逼的版本控制器,这里用于对Github进行操作,当然,你也可以尝试使用GitHub Desktop | Simple collaboration from your desktop但就我而言,这玩意更难用

  3. Node.js — Run JavaScript Everywhere (nodejs.org):Fuwari基于Node.js,你需要安装这个来搭建博客

  4. 一个Github账号:用于创建一个代码仓库存放Fuwari文件

  5. 一个Cloudflare账号:用于创建一个Pages并且绑定域名支持访问

  6. MarkText:这是一个可视化MarkDown编辑器,因为Fuwari的每一篇文章/页面都是MarkDown,所以需要一个好用的编辑器

  7. 你得会用MarkDown语法来编写文章,如果你不会可以参见:Markdown 基本语法 | Markdown 官方教程

流程图#

本地部署Fuwari,编写文章 -> 推送更改到远程Github仓库 -> Cloudflare Pages检测到仓库更新自动构建新的网站静态文件 -> 网站成功更改

让我们开搞吧!#

首先,我们来本地部署Fuwari#

  1. Fork仓库:

https://github.com/saicaca/fuwari

  1. 避免有小废物不会Fork仓库,这里附上图片教程

  2. 1. ![](https://sb-r2.afo.im/fuwari-blog/img/2024-10-14-12-15-44-image.webp)![](https://sb-r2.afo.im/fuwari-blog/img/2024-10-14-12-17-03-image.webp)

    2. 然后将仓库克隆到本地:git clone <你的仓库URL>(推荐使用SSH,可以不用魔法来推送更改)

    1. 首先,全局安装pnpm:npm install -g pnpm(如果npm国内拉取过慢,请尝试cnpm:npmmirror 镜像站)

    2. 然后在项目根目录安装依赖:pnpm install 和 pnpm add sharp

    3. 至此,你成功在本地部署了Fuwari

TIP

你也可以使用创建一个新的空仓库然后手动上传文件,并且可以将仓库可见性设为:Private

改写Fuwari的基本信息并且清理多余文件#

刚创建的Fuwari可能带有一些示例的博主名,ICON,URL,介绍和示例文章,为了让用户知道这是你的博客,我们需要一一改写

1. 在根目录下的 `src` 文件夹中,你可以找到 `config.ts` 我们来开始改写
* title:你的博客主标题
* subtitle:你的博客副标题。可选,在首页会显示为“主标题 - 副标题”
* lang:博客显示语言。注释已经列出了一些常用的值,如:en, zh_CN, zh_TW, ja, ko
* themeColor:hue值则是你的博客主题色,可以在你的博客右上角的画板图标确定喜欢的颜色再填写![](https://sb-r2.afo.im/fuwari-blog/img/2024-10-15-09-16-30-image.webp)
* banner:src:即banner图片,支持http/https URL
* favicon:src:即网站图标,支持http/https URL
* links:即友情链接,这些链接在导航栏上
* avatar:即你的头像
* name:即你的名字
* bio:即个性签名,会显示在头像和名字下面
* `NavBarConfig` 为导航栏设置的超链接。`ProfileConfig` 为你的用户的超链接,分别如图![](https://sb-r2.afo.im/fuwari-blog/img/2024-10-15-17-49-30-image.webp)
* icon:你需要前往[icones.js](https://icones.js.org/)去搜索你想要的图标,比如QQ,则填写 `fa6-brands:qq` ,如图。Fuwari默认支持这几种类型:`fa6-brands`, `fa6-regular`, `fa6-solid`, `material-symbols`。可以在 `astro.config.mjs` 中搜索关键字进行配置
* ![](https://sb-r2.afo.im/myblog/img/1ef05530-10fd-4301-af4e-21ddadf18605.webp)
* ![](https://sb-r2.afo.im/myblog/img/da94494b-cc4b-4f07-ae95-8bf3b2f95d3c.webp)
* 这里我附上我的 `config.ts`
*

[code]import type { LicenseConfig, NavBarConfig, ProfileConfig, SiteConfig, } from ’./types/config’ import { LinkPreset } from ’./types/config’

export const siteConfig: SiteConfig = {
title: '二叉树树的博客',
subtitle: '爱你所爱!',
lang: 'zh_CN', // 'en', 'zh_CN', 'zh_TW', 'ja', 'ko'
themeColor: {
hue: 355, // Default hue for the theme color, from 0 to 360. e.g. red: 0, teal: 200, cyan: 250, pink: 345
fixed: false, // Hide the theme color picker for visitors
},
banner: {
enable: true,
src: 'assets/images/222.webp', // Relative to the /src directory. Relative to the /public directory if it starts with '/'
position: 'center', // Equivalent to object-position, only supports 'top', 'center', 'bottom'. 'center' by default
credit: {
enable: false, // Display the credit text of the banner image
text: '', // Credit text to be displayed
url: '' // (Optional) URL link to the original artwork or artist's page
}
},
favicon: [ // Leave this array empty to use the default favicon
{
src: 'https://q2.qlogo.cn/headimg_dl?dst_uin=2973517380&spec=5', // Path of the favicon, relative to the /public directory
//theme: 'light', // (Optional) Either 'light' or 'dark', set only if you have different favicons for light and dark mode
sizes: '128x128', // (Optional) Size of the favicon, set only if you have favicons of different sizes
}
]
}
export const navBarConfig: NavBarConfig = {
links: [
LinkPreset.Home,
LinkPreset.Archive,
LinkPreset.About,
{
name: '随机图',
url: 'https://pic.onani.cn', // Internal links should not include the base path, as it is automatically added
external: true, // Show an external link icon and will open in a new tab
},
{
name: 'GitHub',
url: 'https://github.com/saicaca/fuwari', // Internal links should not include the base path, as it is automatically added
external: true, // Show an external link icon and will open in a new tab
},
],
}
export const profileConfig: ProfileConfig = {
avatar: 'assets/images/111.webp', // Relative to the /src directory. Relative to the /public directory if it starts with '/'
name: '二叉树树',
bio: 'Protect What You Love./爱你所爱!',
links: [
// {
// name: 'Twitter',
// icon: 'fa6-brands:twitter', // Visit https://icones.js.org/ for icon codes
// You will need to install the corresponding icon set if it's not already included
// `pnpm add @iconify-json/<icon-set-name>`
// url: 'https://twitter.com',
// },
// {
// name: 'Steam',
// icon: 'fa6-brands:steam',
// url: 'https://store.steampowered.com',
// },
{
name: 'GitHub',
icon: 'fa6-brands:github',
url: 'https://github.com/afoim',
},
{
name: 'QQ',
icon: 'fa6-brands:qq',
url: 'https://qm.qq.com/q/Uy9kmDXHYO',
},
{
name: 'QQ',
icon: 'fa6-solid:envelope',
url: 'mailto:acofork@foxmail.com',
},
],
}
export const licenseConfig: LicenseConfig = {
enable: true,
name: 'CC BY-NC-SA 4.0',
url: 'https://creativecommons.org/licenses/by-nc-sa/4.0/',
}

[/code]

2. 清理多余文件。在根目录下的 `src/content/posts` 文件夹中会有一些示例文章,这些文章介绍了一些MarkDown语法和技巧,可以让你更快上手Fuwari和fuwari,我们可以将其保存到别处
3. 至此,你已经可以开始撰写文章了

让我们开始写作!#

1. 首先,在项目根目录执行:`pnpm new-post <这里填写你的文章标题>`
2. 然后,在根目录下的 `src/content/posts` 文件夹中会多出一个 `xxx.md`文件
3. 我们使用MarkText打开这个文件,你可以看到一些基本信息,我们只需要关注几个重要的信息
4.

[code]title: xxx published: 2024-10-14 description: ” image: ” tags: [] categories: ” draft: false lang: ” [/code]

* title:文章标题
* published:文章创建时间
* description:文章描述,正常会显示在文章标题下面
* image:文章封面图(同目录需要写 `./` 如:`./assets/images/2024-10-14-11-33-28-image.webp`)
* tag:文章标签
* categories:文章分类
5. 我们还需要更改根目录下的 `astro.config.mjs` 。在第34行更改 `stie:` 为你的站点URL,如: `site: "https://onani.cn",`
6. 欸?有的人就会问了,MarkDown固然好,但是我要如何处理图片的置入呢
7. 这也很简单,多亏了MarkText这款软件,我们也可以像编辑Typecho一样直接使用Ctrl+CV来在MarkDown语法中置入图片,但是我们需要一些小设置:
* 依次点击:MarkText软件的左上角的三条杠 -> File -> Perferences -> 左侧的Image分类 -> 如图设置 -> 注意更改第一个选项为Copy开头的选项,将Perfer开关打开,然后上下两个文本框一个填写绝对路径一个填写相对路径
* ![](https://sb-r2.afo.im/fuwari-blog/img/2024-10-14-12-54-21-image.webp)
* 这样,当置入图片时,会往 `assets/images` 文件夹复制一份,然后通过`![1](assets/images/1.webp)`写入MarkDown文件。这样网站就能成功读取到图片啦。而你只需要Ctrl+CV,其他操作MarkText都会自动处理
8. 至此,你已经会用MarkText编写MarkDown语法的博文了

本地预览,然后发布到Github#

1. 当你认为你的文章已经写得差不多时,想要看看效果?请到项目根目录执行:`pnpm dev`,稍等片刻,你就可以本地预览你的博客啦![](https://sb-r2.afo.im/fuwari-blog/img/2024-10-14-13-03-44-image.webp)
2. 好!接下来我们需要使用Git将我们所做的更改发布到Github
* 首先,你需要让Git知道你是谁:`git config --global user.name "你的Github用户名"`和`git config --global user.email "你的Github邮箱@example.com"`
* 然后,更改远程仓库为ssh*(如果是通过ssh克隆的不用改):`git remote set-url origin git@github.com:xxx/xxx`
* 随后,让我们提交所有文件:`git add .`
* 之后,让我们发布一个本地提交:`git commit -m "项目初始化"`
* 最后,让我们将本地更改提交到远程仓库:`git push`
3. 此时,你的Github仓库应该已经有了新的提交![](https://sb-r2.afo.im/fuwari-blog/img/2024-10-14-13-10-12-image.webp)

让Cloudflare连接上Github,使用Pages服务展示你的博客(FREE!)#

1. 前往Cloudflare的 Workers 和 Pages 页面,创建一个新Pages![](https://sb-r2.afo.im/fuwari-blog/img/2024-10-14-13-14-28-image.webp)
2. 然后选择连接Git存储库,连接你的Github,随后设置构建命令:`pnpm build` ,然后设置构建输出目录:`dist` ,如图![](https://sb-r2.afo.im/fuwari-blog/img/2024-10-14-13-16-15-image.webp)
3. 绑定自定义域,访问自定义域即可访问你的博客!![](https://sb-r2.afo.im/fuwari-blog/img/2024-10-14-13-17-00-image.webp)
4. 随后,你只需要在本地编写文章,然后[使用Git将更改推送到远程仓库](https://www.afo.im/posts/fuwari/#%E6%9C%AC%E5%9C%B0%E9%A2%84%E8%A7%88%E7%84%B6%E5%90%8E%E5%8F%91%E5%B8%83%E5%88%B0github),Cloudflare就会自动部署,更新你的博客!

支持与分享

如果这篇文章对你有帮助,欢迎分享给更多人或打赏支持!

打赏
Fuwari静态博客搭建教程
https://welcome4535.de5.net/posts/fuwari/
作者
码境科技
发布于
2025-07-17
许可协议
CC BY-NC-SA 4.0
相关文章智能推荐
1
fuwari博客(研究2天终于研究成功)
建站不是你网络的问题,也不是 Stylus 包被彻底下架,而是刚刚发生了一个 安全事件 :npm 因为发现 Stylus 包中存在恶意代码,于 2025 年 7 月 23 日凌晨左右 (UTC 时间)将所有 Stylus 版本从注册表中移除了,并发布了一个占位版本 0.0.1‑sec
2
xboard机场搭建教程
建站准备工作 下载并安装SSH连接工具Finalshell:【 点击进入 】 做好域名解析Cloudflare:【 点击进入 】 1、关闭防火墙 sudo ufw disable Copy 2、一键安装NPM反向代理面板 sudo apt install git -y && git
3
【Hexo博客系列】No.1 搭建Hexo博客,快速简洁高效,零成本搭建个人博客:Hexo + GitHub Pages +
建站搭建Hexo博客,快速简洁高效,零成本搭建个人博客:Hexo + GitHub Pages + Cloudflare Pages 完整指南 本文详细介绍了如何使用Hexo框架搭建一个个人博客,并将其部署到GitHub Pages和Cloudflare Pages上。主要内容包括:
4
heroku最新教程
建站提示:UUID请使用UUID生成器,推荐 UUID Generator 提醒:滥用可能导致账户被删除!!! 提醒:配置连接方式时请仔细阅读带粗体的注意事项! ! ! 请之前已经fork过的用户删除项目后重新fork本项目! ! ! 已恢复Vmess、VLESS、Trojan、Sh
5
Heroku部署V2ray节点教程
建站准备材料 一枚GitHub账号 一枚Heroku账号 一枚CloudFlare账号 部署步骤 注册好GitHub账号 打开 仓库 ,并Fork一份 进入“Settings”,输入名称,改名 将README.md中的部署链接的的原仓库地址改成自己的仓库地址 注册并登录Heroku账
随机文章随机推荐

评论区

Profile Image of the Author
码境科技
Hello, I'm 码境科技。
公告
这里是码境科技的博客,分享建站、玩机与 AI 折腾。
分类
标签
最新动态
站点统计
文章
327
分类
44
标签
47
总字数
839,103
运行时长
0 天
最后活动
0 天前
站点信息
构建平台
Vercel
博客版本
Firefly v6.16.9
文章许可
CC BY-NC-SA 4.0
文章目录