摘要: Astro-Fuwari主题配置
项目主页 https://github.com/saicaca/fuwari
文档https://github.com/saicaca/fuwari/blob/main/docs/README.zh-CN.md
环境要求 安装git scm https://git-scm.com/
1 2 安装pnpm npm install -g pnpm@9.15.9
下载代码 使用右上角template模版到自己仓库, 并克隆代码到本地
1 2 3 4 5 6 7 8 安装依赖 pnpm install pnpm add sharp 如果报错 pnpm config set sharp_binary_host "https://npmmirror.com/mirrors/sharp" pnpm config set sharp_libvips_binary_host "https://npmmirror.com/mirrors/sharp-libvips" 之后再pnpm add sharp
配置 1 通过配置文件 src/config.ts 自定义博客
指令 下列指令均需要在项目根目录执行:
Command Action pnpm install 并 pnpm add sharp安装依赖 pnpm dev在 localhost: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 2 category: [] 为空必须这么写 tags: [] 为空必须这么写
禁止某页面评论 1 2 3 4 5 6 7 二次开发后 增加支持 comments: false ----------一般用这个就行了 hexo写法 comment: enable: false ------------hugo next写法 comment: false ------------vuepress2 hope 写法