578 字
3 分钟
Fuwari安装&使用

本文档为使用github page部署的指南

安装fuwari(二选一)#

1.直接fork原仓库#

saicaca
/
fuwari
Waiting for api.github.com...
00K
0K
0K
Waiting...

2,用pnpm安装#

Terminal window
pnpm create fuwari@latest

按命令输出需求依次输入项目名称,网站名称,副标题,语言

Terminal window
Please enter the project name: 输入项目名称
Please enter the site title: 输入网站名称
Please enter the site subtitle: 输入副标题
Please select the language of the site. zh_CN
Install Dependencies? Yes
Initialize Git? Yes

配置fuwari#

TIP

用pnpm安装时,基础网站信息会提前更改

手动设置网站信息src/config.ts#

网站基本信息在export const siteConfig: SiteConfig:{

title: 网站标题,
subtitle: 副标题,
lang: "zh_CN"

横幅

banner: {
enable: false,
src: "assets/images/banner.png",
}

头像内容在export const profileConfig: ProfileConfig = {

avatar: "assets/images/demo-avatar.png",
name: "Lorem Ipsum",

图片相关按照目录路径输入

设置astro.config.mjs#

项目根目录下打开astro.config.mjs 设置

// https://astro.build/config
export default defineConfig({
site: "https://fuwari.vercel.app/",
base: "/",
trailingSlash: "always",
)}

按github项目名分两种情况

  1. 名为username.github.io

base可注释掉

site:"https://username.github.io"
base:"/"
  1. 其他名称

项目名例如 newpost

site:"https://username.github.io"
base:"/newpost"

github action 设置#

关闭github已有action#

IMPORTANT

不关会一直报错给你发邮件

在github项目页面的Settings > Pages 中

将Build and deployment即生成和部署的方式改为

GitHub Action

配置提交代码即运行action#

TIP

若已有此文件可跳过

.github/workflows目录下新建build.yml

name: Deploy to GitHub Pages
on:
# Trigger the workflow every time you push to the `main` branch
# Using a different branch name? Replace `main` with your branch’s name
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:
# Allow this job to clone the repo and create a page deployment
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v4
- name: Install, build, and upload your site
uses: withastro/action@v2
with:
# path: . # The root location of your Astro project inside the repository. (optional)
# node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 20. (optional)
package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

使用#

本地运行并参考效果#

Terminal window
#安装依赖项
pnpm install
#运行
pnpm run dev
pnpm dev

新建post#

Terminal window
pnpm new-post 名称

若需要插入图片,新建文件夹并改名为index.md

  • newpost.md
  • newpost
    • index.md
    • picture.jpg

  • newpost
    • index.md
    • image
      • picture.jpg

图片追加#

//md文件内添加
![](image/chibiysyk.gif)

参考来源: Fuwari, Astro doc, Markdown 基本语法

Fuwari安装&使用
https://sinsax.github.io/posts/fuwari-install/
作者
SInsa
发布于
2025-08-18
许可协议
CC BY-NC-SA 4.0