Skip to content
Souloss
Go back

astro-minimax 功能特性总览

完整介绍 astro-minimax 的所有功能特性,包括内容管理、可视化组件、AI 集成、互动系统等。

astro-minimax 是一个功能丰富的 Astro 博客主题,采用模块化架构设计。本文全面介绍所有功能特性及其使用方式。

架构概览

astro-minimax 由四个核心包组成,形成清晰的层次架构:

graph TB
    subgraph 用户博客
        Config[src/config.ts]
        Content[src/data/blog/]
        Functions[functions/api/]
    end

    subgraph "@astro-minimax 包"
        Core["@astro-minimax/core
布局·组件·路由·插件·可视化"] AI["@astro-minimax/ai
RAG·Provider·聊天UI"] Notify["@astro-minimax/notify
Telegram·Email·Webhook"] CLI["@astro-minimax/cli
创建·处理·评估"] end Config --> Core Content --> Core Core --> AI AI --> Notify Functions --> AI CLI --> Content style Core fill:#3b82f6,color:#fff style AI fill:#10b981,color:#fff style Notify fill:#f59e0b,color:#fff style CLI fill:#ef4444,color:#fff
说明必需
@astro-minimax/core核心主题:布局、组件、样式、可视化(Mermaid/Markmap 等)
@astro-minimax/aiAI 集成:多 Provider 聊天、RAG 检索、流式响应可选
@astro-minimax/notify通知系统:Telegram、Email、Webhook 多渠道通知可选
@astro-minimax/cliCLI 工具:博客创建、AI 内容处理、画像构建、质量评估推荐

内容管理

Markdown / MDX

所有文章使用 Markdown 或 MDX 编写,支持:

多语言

内置中文/英文双语支持。文章按语言分目录组织:

src/data/blog/
├── zh/     # 中文文章
└── en/     # 英文文章
plaintext

通过 URL 前缀区分语言:/zh/posts/.../en/posts/...

内容组织

标签

每篇文章可以有多个标签,用于灵活的交叉分类:

tags:
  - astro
  - typescript
  - tutorial
yaml

标签页面 (/tags/) 展示标签云,点击标签可查看该标签下的所有文章。

分类

支持层级分类,使用 / 分隔:

category: 教程/配置
yaml

分类页面 (/categories/) 展示树形分类结构。

系列文章

将相关文章组织为有序系列:

series:
  name: Rust 入门
  order: 1
yaml

系列页面会自动生成导航,显示上一篇/下一篇。

归档

按时间线展示所有文章的归档页面 (/archives/)。可通过 features.archives 开关控制。

Frontmatter

每篇文章的元数据通过 frontmatter 定义:

---
title: 文章标题
pubDatetime: 2026-03-14T10:00:00Z
modDatetime: 2026-03-20T01:46:35Z
author: Souloss
description: 文章描述
tags: [astro, tutorial]
category: 教程/配置
series: { name: "系列名称", order: 1 }
featured: true
draft: false
ogImage: ./cover.png
---
yaml

详见 添加文章指南


搜索

支持两种搜索方案,通过 search.provider 配置切换:

Pagefind 全文搜索(默认)

内置 Pagefind 静态搜索引擎:

搜索索引在 pnpm run build 时自动生成。

Algolia DocSearch

支持 Algolia DocSearch 云搜索:

配置方式:

search: {
  provider: 'docsearch',
  docsearch: {
    appId: 'YOUR_APP_ID',
    apiKey: 'YOUR_SEARCH_API_KEY',
    indexName: 'YOUR_INDEX_NAME',
  },
},
typescript

主题与样式

明暗模式

支持三种主题模式:

主题切换使用 View Transitions 动画,切换过程流畅自然。可通过 darkMode 控制是否启用。

自定义配色

通过 CSS 变量自定义整站配色,支持独立的浅色/深色方案:

:root {
  --background: #ffffff;
  --foreground: #1a1a2e;
  --accent: #3b82f6;
  --muted: #6b7280;
  --border: #e5e7eb;
}

[data-theme="dark"] {
  --background: #0f172a;
  --foreground: #e2e8f0;
  --accent: #60a5fa;
  --muted: #94a3b8;
  --border: #334155;
}
css

详见 自定义配色方案

响应式设计

全站采用移动优先的响应式设计:


可视化组件

@astro-minimax/core 包提供丰富的可视化组件。

Mermaid 图表

在 Markdown 中直接编写 Mermaid 图表:

```mermaid
graph TD
  A[开始] --> B{判断}
  B -->|是| C[执行]
  B -->|否| D[跳过]
```
markdown

支持流程图、时序图、甘特图、饼图、类图等所有 Mermaid 图表类型。自动适配明暗主题。

Markmap 思维导图

使用 Markdown 大纲语法生成交互式思维导图:

```markmap
# 中心主题
## 分支 A
### 子节点 1
### 子节点 2
## 分支 B
### 子节点 3
```
markdown

支持缩放、拖拽、展开/折叠等交互操作。

Rough.js 手绘图形

在 MDX 中使用手绘风格的 SVG 图形:

import RoughDrawing from '@astro-minimax/core/components/viz/RoughDrawing.astro';

<RoughDrawing shapes={[
  { type: "rectangle", x: 10, y: 10, width: 200, height: 100 }
]} />
mdx

Excalidraw 白板

嵌入 Excalidraw 白板式图表:

import ExcalidrawEmbed from '@astro-minimax/core/components/viz/ExcalidrawEmbed.astro';

<ExcalidrawEmbed src="/drawings/architecture.excalidraw" />
mdx

自动适配明暗主题。

Asciinema 终端回放

嵌入终端录制回放:

import AsciinemaPlayer from '@astro-minimax/core/components/viz/AsciinemaPlayer.astro';

<AsciinemaPlayer src="/casts/demo.cast" cols={120} rows={30} />
mdx

更多组件

组件说明
BilibiliB 站视频嵌入
MusicPlayer音乐播放器(支持网易云、QQ 音乐等)
CodeRunner交互式 JavaScript 代码运行器
FullHtmlEmbed完整 HTML 页面嵌入
VizContainer可视化容器(缩放、平移、全屏)

AI 聊天

@astro-minimax/ai 包提供智能对话能力。

功能特点

使用方式

AI 聊天以浮动组件形式出现在页面右下角。点击打开对话窗口,可以:

配置

src/config.ts 中启用:

ai: {
  enabled: true,
  mockMode: false,       // 生产环境设为 false
  apiEndpoint: "/api/chat",
  model: "@cf/zai-org/glm-4.7-flash",
},
js

详见 配置指南


互动系统

Waline 评论

内置 Waline 评论系统:

需要自行部署 Waline 服务端。详见 配置指南

赞助打赏

支持多种支付方式的打赏功能:

在文章底部显示打赏按钮和二维码。支持展示赞助者列表。

通知系统

多渠道通知,实时了解博客动态:

支持丰富的通知内容:Token 用量、阶段耗时、引用文章等。Session ID 自动匿名化保护隐私。

详见 通知系统配置指南


SEO 与性能

动态 OG 图片

未指定 OG 图片的文章会自动生成:

详见 动态 OG 图片

SEO 优化

性能优化


代码增强

语法高亮

使用 Shiki 提供精美的代码高亮:

数学公式

通过 KaTeX 渲染 LaTeX 数学公式:

行内公式:$E = mc^2$

块级公式:

$$
\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
$$
latex

详见 如何添加 LaTeX 公式


分析统计

Umami

集成 Umami 隐私友好的访问统计:

需要自行部署 Umami 实例。


辅助功能

其他特性

特性说明
友链页面展示友情链接,支持头像、描述
项目展示GitHub 仓库卡片,自动获取仓库信息
图片灯箱点击图片放大预览
阅读进度保存和恢复阅读位置
浮动目录文章页侧边栏浮动目录导航
面包屑页面层级导航
版权声明文章底部显示许可证信息
编辑链接文章标题下显示”在 GitHub 上编辑”链接
键盘导航支持键盘快捷键操作
无障碍WCAG 2.1 AA 级别合规
View Transitions页面切换动画
预加载链接预加载提升导航速度

功能启用速查

src/config.tsfeatures 中控制所有功能开关:

features: {
  tags: true,        // 标签系统
  categories: true,  // 分类系统
  series: true,      // 系列文章
  archives: true,    // 归档页面
  friends: true,     // 友链页面
  projects: true,    // 项目展示
  search: true,      // 全文搜索
},
darkMode: true,     // 明暗主题
js

CLI 工具链

@astro-minimax/cli 提供完整的命令行工具,用于博客管理和 AI 内容处理。

安装

CLI 工具随 @astro-minimax/cli 包安装,也可以通过 npx astro-minimax 临时使用。

主要命令

命令说明
astro-minimax init创建新博客项目
astro-minimax aiAI 内容处理(摘要、SEO、评估)
astro-minimax profile作者画像管理(上下文、风格、报告)
astro-minimax post文章管理(新建、列表、统计)
astro-minimax data数据管理(状态查看、缓存清理)

使用示例

astro-minimax post new "文章标题"    # 创建新文章
astro-minimax ai process              # AI 处理所有文章
astro-minimax ai eval                 # 评估 AI 对话质量
astro-minimax profile build           # 构建完整作者画像
astro-minimax data status             # 查看数据状态
bash

所有命令也有 pnpm run 快捷方式(如 pnpm run ai:process)。详见 CLI 使用指南

AI 评估系统

内置黄金测试集(datas/eval/gold-set.json),自动化评估 AI 对话质量:

pnpm run ai:eval                              # 本地测试
pnpm run ai:eval -- --url=https://your-blog.com  # 远程测试
bash

更多资源



上一篇
部署指南:多平台部署 astro-minimax
下一篇
Asciinema 终端回放

评论区

文明评论,共建和谐社区