Skip to content

About

✨A static blog template built with Astro.基于fuwari修改,与我目前的博客功能同步的仓库,为保证某些内容不被泄露,特意建立此仓库与博客部署仓库分离开来。

Topics

Resources

Contributing

Stars

11 stars

Watchers

0 watching

Forks

Latest commit

 

History

347 Commits

Folders and files

Repository files navigation

Astro/fuwai博客配置教程

前言

新博客站点部署也有2周多时间了,新站的访问量不是很多,但是我发现有人是用我的fuwai_zyplj仓库去修改配置然后再部署自己的博客,因为我个人喜欢对博客乱改,所以我这边出一个教程,来讲讲如何部署和我一样的博客。

本篇文章重点讲解博客配置!!!

为了方便大家使用我的仓库,我特意将原本的仓库改为私有,新建了一个公共的仓库,包括不限于没有我的文章、其他第三方配置。

我的博客只是在原作者fuwari仓库的基础上增加了:

  1. 音乐播放器

  2. 文章置顶固定(原作者仓库PR中的)

  3. 评论系统

  4. 友链页面

  5. 首图支持视频

  6. 图片页面

  7. 多级菜单

  8. 友链朋友圈

  9. 评论系统图片点击放大

  10. 博客添加codex宠物

  11. 如果对于上述功能不感兴趣的可以直接clone原作者的仓库。

页面基础配置

大部分页面配置都在src/config.ts文件中完成,大部分配置都有注释。重点讲解我添加的配置。

banner图换成视频

将type设置为video,然后将src指向视频MP4格式的视频文件,注意视频文件放在 public/videos/ 目录下。

banner: {
    enable: true,
    src: "assets/images/banner.jpg", // Relative to the /src directory. Relative to the /public directory if it starts with '/'
    // 如果要使用MP4视频,可以这样配置:
    // src: "/videos/banner-video.mp4", // 视频文件放在 public/videos/ 目录下
    // type: "video", // 设置为视频类型
    position: "center", // Equivalent to object-position, only supports 'top', 'center', 'bottom'. 'center' by default
    type: "image", // Support 'image' or 'video' format
    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
    },
},

Microsoft Clarity 分析

Microsoft Clarity是微软提供的用于网站流量分析的工具,如果用不上改成false即可,如果想用就需要去官网注册个账号:https://clarity.microsoft.com/

clarity: {
    enable: false, // 是否启用 Microsoft Clarity 分析
    projectId: "", // Clarity 项目 ID
},

音乐播放器

在public/lib/MasterMusic.js中修改音乐数据源。

musicPlayer: {
    enable: true, // 是否启用音乐播放器
},

评论系统

envId替换成你部署的评论系统的域名或者ip地址。

本博客集成的快速上手 | Twikoo 文档评论系统,如果想部署这个评论系统,官网的部署文档还是很详细的,推荐有服务器的人使用宝塔+Docker部署。

如果不想用或者部署不好评论系统,修改enable为false就能关闭评论。

export const commentConfig = {
	enable: true,
	provider: "twikoo",
	twikoo: {
		envId: "https://api.pljzy.top", // 移除末尾的斜杠
		region: "",
		lang: "zh-CN",
	},
};

如果发现评论系统没有出现,可能是CDN文件引入的问题,可以在src/components/Comment.astro组件中修改CDN文件路径。

// https://twikoo.js.org/frontend.html CDN指南
const script = document.createElement('script');
script.src = 'https://registry.npmmirror.com/twikoo/1.6.44/files/dist/twikoo.min.js' 

友链页面

src/content/spec/links.md友链页面其实就是md文件,如果有新的友链,将参考的div复制一份修改里面的内容就行了,对于没有评论系统的,也想使用友链,可以将自己仓库的issues地址放出来,让其他博主在github上体积issues来达到友链提交的效果

文章置顶

pinned 属性设置为true即为置顶显示

---
title: ***文章标题
published: 2025-06-21 发布时间
description: 文章简介
image: ./5.png 文章首图,非必须可删除。
tags: [日常,测试] 文章标签 可多个 
category: 记录生活 文章分类
draft: false 
pinned: false 文章是否固定、置顶
---

多提一嘴

大部分博客的配置都是在src/config.ts文件中完成,文章底部显示的内容在src/components/Footer.astro组件中设置。 部署博客的话可以参考:基于Astro开发的Fuwari静态博客模版配置CICD流程 - ZY知识库--https://blog.pljzy.top/posts/astro/ 这篇文章

结语

上述就是博主所集成的工具开关,如果还有问题可以在文章下留言。 推荐先去了解原作者的模版:fuwari--https://github.com/saicaca/fuwari。 如果喜欢本博客集成功能可以参考代码添加进去。

🍥Fuwari

Node.js >= 20 pnpm >= 9 DeepWiki FOSSA Status

A static blog template built with Astro.

🖥️ Live Demo (Vercel)

Preview Image

🌏 README in 中文 / 日本語 / 한국어 / Español / ไทย (Provided by the community and may not always be up-to-date)

✨ Features

🚀 Getting Started

  1. Create your blog repository:
    • Generate a new repository from this template or fork this repository.
    • Or run one of the following commands:
      npm create fuwari@latest
      yarn create fuwari
      pnpm create fuwari@latest
      bun create fuwari@latest
      deno run -A npm:create-fuwari@latest
  2. To edit your blog locally, clone your repository, run pnpm install to install dependencies.
    • Install pnpm npm install -g pnpm if you haven't.
  3. Edit the config file src/config.ts to customize your blog.
  4. Run pnpm new-post <filename> to create a new post and edit it in src/content/posts/.
  5. Deploy your blog to Vercel, Netlify, GitHub Pages, etc. following the guides. You need to edit the site configuration in astro.config.mjs before deployment.

📝 Frontmatter of Posts

---
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      # Set only if the post's language differs from the site's language in `config.ts`
pinned: false
---

🧩 Markdown Extended Syntax

In addition to Astro's default support for GitHub Flavored Markdown, several extra Markdown features are included:

⚡ Commands

All commands are run from the root of the project, from a terminal:

Command Action
pnpm install Installs dependencies
pnpm dev Starts local dev server at localhost:4321
pnpm build Build your production site to ./dist/
pnpm preview Preview your build locally, before deploying
pnpm check Run checks for errors in your code
pnpm format Format your code using Biome
pnpm new-post <filename> Create a new post
pnpm astro ... Run CLI commands like astro add, astro check
pnpm astro --help Get help using the Astro CLI

✏️ Contributing

Check out the Contributing Guide for details on how to contribute to this project.

📄 License

This project is licensed under the MIT License.

FOSSA Status

About

✨A static blog template built with Astro.基于fuwari修改,与我目前的博客功能同步的仓库,为保证某些内容不被泄露,特意建立此仓库与博客部署仓库分离开来。

Topics

Resources

Contributing

Stars

11 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages