Astro-Fuwari主题配置

摘要: Astro-Fuwari主题配置


项目主页

https://github.com/saicaca/fuwari

文档https://github.com/saicaca/fuwari/blob/main/docs/README.zh-CN.md

环境要求

  • Node.js <= 22
  • pnpm <= 9

安装git scm https://git-scm.com/

1
2
安装pnpm
npm install -g pnpm@9.15.9

下载代码

使用右上角template模版到自己仓库, 并克隆代码到本地

1
2
3
安装依赖
pnpm install
pnpm add sharp

配置

1
通过配置文件 src/config.ts 自定义博客

指令

下列指令均需要在项目根目录执行:

CommandAction
pnpm installpnpm add sharp安装依赖
pnpm devlocalhost:4321 启动本地开发服务器
pnpm build构建网站至 ./dist/
pnpm preview本地预览已构建的网站
pnpm new-post <filename>创建新文章
pnpm astro ...执行 astro add, astro check 等指令
pnpm astro --help显示 Astro CLI 帮助

写作

1
执行 pnpm new-post <filename> 创建新文章,并在 src/content/posts/ 目录中编辑
1
2
3
4
5
6
7
8
9
10
---
title: My First Blog Post
published: 2023-09-09
description: This is the first post of my new Astro blog.
image: ./cover.jpg
tags: [Foo, Bar]
category: Front-end
draft: false
lang: jp # 仅当文章语言与 `config.ts` 中的网站语言不同时需要设置
---

部署cloudflare pages

1
署前需编辑 astro.config.mjs 中的站点设置。

构建命令

1
pnpm run build

输出目录

1
dist