- Node.js ≥ 22
- pnpm ≥ 11
-
克隆仓库:
git clone https://github.com/Cuteleaf/Firefly.git cd Firefly先 Fork 到自己仓库再克隆(推荐),记得先点 Star 再 Fork 哦!
git clone https://github.com/you-github-name/Firefly.git cd Firefly -
安装依赖:
# 如果没有安装 pnpm,先安装 npm install -g pnpm # 安装项目依赖 pnpm install
-
配置博客:
- 编辑
src/config/目录下的配置文件自定义博客设置
- 编辑
-
启动开发服务器:
pnpm dev
博客将在
http://localhost:4321可用
-
参考官方指南将博客部署至 Vercel, Netlify, Cloudflare Pages, EdgeOne Pages 等。
-
Vercel、Netlify 等主流平台自动部署,会根据环境自动选择适配器。
框架预设:
Astro根目录:
./输出目录:
dist构建命令:
pnpm run build安装命令:
pnpm install
📚 详细配置文档: 查看 Firefly 使用文档 获取完整的配置指南
要设置博客的默认语言,请编辑 src/config/siteConfig.ts 文件:
// 定义站点语言
const SITE_LANG = "zh_CN";支持的语言代码:
zh_CN- 简体中文zh_TW- 繁体中文en- 英文ja- 日文ru- 俄文ko- 韩文
src/
├── config/
│ ├── index.ts # 配置索引文件
│ ├── siteConfig.ts # 站点基础配置
│ ├── analyticsConfig.ts # 统计分析配置
│ ├── announcementConfig.ts # 公告配置
│ ├── backgroundWallpaper.ts # 背景壁纸配置
│ ├── commentConfig.ts # 评论系统配置
│ ├── coverImageConfig.ts # 封面图配置
│ ├── displaySettingsConfig.ts # 设置面板配置
│ ├── dynamicConfig.ts # 动态页面配置
│ ├── effectsConfig.ts # 动画特效配置(樱花等)
│ ├── expressiveCodeConfig.ts # 代码高亮配置
│ ├── fontConfig.ts # 字体配置
│ ├── FooterConfig.html # 页脚配置
│ ├── friendsConfig.ts # 友链配置
│ ├── galleryConfig.ts # 相册配置
│ ├── licenseConfig.ts # 许可证配置
│ ├── musicConfig.ts # 音乐播放器配置
│ ├── navBarConfig.ts # 导航栏配置
│ ├── pioConfig.ts # 看板娘配置
│ ├── mermaidConfig.ts # Mermaid 图表配置
│ ├── plantumlConfig.ts # PlantUML 图表配置
│ ├── profileConfig.ts # 用户资料配置
│ ├── sidebarConfig.ts # 侧边栏布局配置
│ └── sponsorConfig.ts # 打赏配置
---
title: My First Blog Post
published: 2023-09-09
description: This is the first post of my new Astro blog.
image: ./cover.jpg # 或使用 "api" 来启用随机封面图
tags: [Foo, Bar]
category: Front-end
draft: false
lang: zh-CN # 仅当文章语言与 `siteConfig.ts` 中的网站语言不同时需要设置
pinned: false # 置顶
comment: true # 是否允许评论
---动态文件保存在 src/content/dynamic/ 中,一个 Markdown 文件对应一条动态。可以使用快捷命令创建:
pnpm new-d 今天心情不错,出去吃了一顿火锅pnpm new-dynamic <content> 也可以使用,和 new-d 完全等价。
---
published: 2026-07-15 16:15:29
pinned: true # 置顶
location: China # 位置
---
动态内容可以使用 Markdown 语法。也支持对接 Memos 作为数据源,在 src/config/dynamicConfig.ts 中配置 memos 选项即可实时获取 Memos 动态,支持置顶同步和图片附件展示。详见动态文档。
下列指令均需要在项目根目录执行:
| Command | Action |
|---|---|
pnpm install |
安装依赖 |
pnpm dev |
在 localhost:4321 启动本地开发服务器 |
pnpm build |
构建网站至 ./dist/ |
pnpm preview |
本地预览已构建的网站 |
pnpm check |
检查代码中的错误 |
pnpm format |
使用 Biome 格式化您的代码 |
pnpm new-post <filename> |
创建新文章 |
pnpm new-d <content> |
创建一条动态 |
pnpm new-dynamic <content> |
创建一条动态(完整命令) |
pnpm astro ... |
执行 astro add, astro check 等指令 |
pnpm astro --help |
显示 Astro CLI 帮助 |