Astro 文档主题,文章页静态生成,搜索接口服务器端渲染
semantic-docs — Astro 文档模板
作者 llbbl
基于 Astro 的文档主题,内置由 libSQL/Turso 支持的语义向量搜索,包含静态文章页与服务器端搜索接口。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
全部页面与视图 3
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
内置语义搜索,由 @logan/libsql-search 与 libSQL/Turso 提供索引
Markdown 内容按文件夹组织为侧边栏分组,frontmatter 支持 title、tags、description、order
默认使用 Cloudflare Workers AI 的 bge-m3 嵌入模型,索引维度 1024
提供离线嵌入服务,可在无任何账号的情况下跑通索引与搜索流程
附带 CI、Codecov 与 Release 徽章,仓库采用 MIT 许可
模板详细介绍
semantic-docs 是一个 Astro 文档主题,把静态文档页面与语义搜索放在同一个项目里。搜索由 @logan/libsql-search 提供,内容索引存放在 libSQL/Turso 中,因此不需要再接入独立的托管搜索服务。
内容以 Markdown 形式放在 ./content 目录下,按文件夹划分章节:文件夹成为侧边栏分组,frontmatter 可定义 title、tags、description 和 order,文件夹顺序在 src/config/nav.ts 中配置。主题会根据内容生成侧边栏导航和文章目录,文章页为静态页面,搜索走服务器端渲染的接口。
索引与搜索依赖嵌入向量。默认使用 Cloudflare Workers AI 的 @cf/baai/bge-m3 模型,索引名为 articles_cf_bgem3_1024、维度 1024,因此需要设置 CLOUDFLARE_ACCOUNT_ID 和 CLOUDFLARE_API_TOKEN;被索引的文本和每次搜索查询都会发送到 Cloudflare。仓库也提供离线嵌入服务,可在没有任何账号的情况下跑通整条流程,但其向量是哈希词袋而非模型,只用于验证流程可运行,不能用来判断搜索质量。
运行环境要求 Node.js >=22.13.0 和 pnpm 11。本地开发路径不依赖 Turso 凭据,需要远程 libSQL/Turso 数据库时改用文档中由 .env 驱动的命令。
适合你的项目吗?
适用场景
- 为 Markdown 文档站点加入语义搜索,而不引入独立的托管搜索产品
- 需要自行掌控文档布局、内容组织与部署方式的 Astro 项目
- 希望先在本地无凭据环境验证索引与搜索流程是否跑通
- 需要把内容索引存放在 libSQL/Turso 中并自行管理
适合人群
- 使用 Astro 构建文档站点的开发者
- 希望在文档中提供语义搜索而非仅关键词匹配的团队
- 愿意配置 Cloudflare Workers AI 或自建嵌入服务的项目
- 需要 MIT 许可、可自行修改和分发的文档主题的用户
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
需要 Node.js >=22.13.0 与 pnpm 11。
- 2
克隆仓库后执行 pnpm install、pnpm db:init:local、pnpm index:local、pnpm dev,默认访问 http://localhost:4321。
- 3
使用 Cloudflare Workers AI 时需在 .env 中设置 CLOUDFLARE_ACCOUNT_ID 与 CLOUDFLARE_API_TOKEN,索引和搜索的文本都会发送到 Cloudflare。
- 4
无凭据时可另开终端运行 pnpm embeddings:offline,并通过 OFFLINE_EMBEDDINGS_BASE_URL 指向本地服务;该离线向量为哈希词袋,仅用于验证流程。
- 5
切换到远程 libSQL/Turso 数据库时,改用文档中由 .env 驱动的命令。
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
- 默认索引与搜索依赖 Cloudflare Workers AI,必须配置 CLOUDFLARE_ACCOUNT_ID 与 CLOUDFLARE_API_TOKEN 才能运行索引和搜索。
- 被索引的文本以及每一次搜索查询都会发送到 Cloudflare 外部服务。
- 离线嵌入服务的向量是哈希词袋而非真实模型,仅能验证流程可运行,不能用于评估搜索质量。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
indexing and search both call Cloudflare Workers AI, so `CLOUDFLARE_ACCOUNT_ID` and `CLOUDFLARE_API_TOKEN` must be set before `pnpm index:local`.
README 原文
Text you index and every search query are sent to Cloudflare.
README 原文
https://github.com/llbbl/semantic-docs/blob/main/LICENSEhttps://github.com/llbbl/semantic-docs/blob/main/README.mdIts vectors are a hashed bag of words rather than a model, and live in their own table — good enough to prove the pipeline runs, and not a basis for judging search quality.
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-05。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- Astro Themes
- 资料与维护参考分
- 资料较完整 · 92 / 100
- 技术栈
- Astro · React
- 网站类型
- 文档
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2026-10-03
- 截图检查日期
- 2026-10-05
已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。
目录记录的主要技术栈是 Astro。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
审核声明: [email protected] · 2026-10-05
查看当时使用的来源资料
SHA-256: 8167c3215330ce395e300a0f678608734246212ea042a4ae20c8fe077b94b220
2026-10-05T03:29:45.213Z
来源文件 / 仓库# semantic-docs
[](https://codecov.io/gh/llbbl/semantic-docs) [](https://github.com/llbbl/semantic-docs/actions/workflows/ci.yml) [](https://github.com/llbbl/semantic-docs/releases)
`semantic-docs` is an Astro documentation theme with built-in semantic search powered by [`@logan/libsql-search`](https://github.com/llbbl/libsql-search). It gives you static docs pages, a server-rendered search API, and a libSQL/Turso-backed content index without adding a separate hosted search product.
Use it when you want:
- semantic search over Markdown content with a small operational footprint
- a docs site you can ship quickly without giving up control of layout, content, or deployment
- a lightweight alternative to bolting on a hosted search product
## What You Get
- Semantic search in the header, backed by libSQL/Turso
- Static article pages with a server-rendered search endpoint
- Sidebar navigation and table of contents generated from your content
- A local development path that works without Turso credentials
## Quick Start
Requires Node.js `>=22.13.0` and pnpm `11`.
```bash
git clone https://github.com/llbbl/semantic-docs.git
cd semantic-docs
pnpm install
pnpm db:init:local
pnpm index:local
pnpm dev
```
Open `http://localhost:4321`.
The local path works without Turso credentials, but indexing and search both
call Cloudflare Workers AI, so `CLOUDFLARE_ACCOUNT_ID` and `CLOUDFLARE_API_TOKEN`
must be set before `pnpm index:local`. Copy `.env.example` to `.env` to fill them
in. The current repo defaults to the `articles_cf_bgem3_1024` index at 1024
dimensions, the fixed width of `@cf/baai/bge-m3`. When you want a remote
libSQL/Turso database, switch to the `.env`-driven commands in the docs.
Text you index and every search query are sent to Cloudflare.
### Without credentials
To run the whole pipeline with no accounts at all, start the bundled offline
embedding service in a second terminal and point the app at it:
```bash
pnpm embeddings:offline
OFFLINE_EMBEDDINGS_BASE_URL=http://127.0.0.1:8788/v1 pnpm db:init:local
OFFLINE_EMBEDDINGS_BASE_URL=http://127.0.0.1:8788/v1 pnpm index:local
OFFLINE_EMBEDDINGS_BASE_URL=http://127.0.0.1:8788/v1 pnpm dev
```
This is what CI uses, so fork and Dependabot pull requests exercise indexing,
prerendering, and search. Its vectors are a hashed bag of words rather than a
model, and live in their own table — good enough to prove the pipeline runs, and
not a basis for judging search quality.
## Documentation
- [Docs index](./docs/README.md)
- [Setup and indexing](./docs/GETTING_STARTED.md)
- [Deployment notes](./docs/DEPLOYMENT.md)
- [Project reference](./docs/REFERENCE.md)
- [Security considerations](./docs/SECURITY.md)
- [Just task runner](./docs/just.md)
## Content Shape
Store Markdown under `./content` using folder-based sections:
```text
content/
├── getting-started/
│ └── intro.md
├── guides/
│ └── deployment.md
└── reference/
└── api.md
```
Folders become sidebar groups, and frontmatter can define `title`, `tags`,
`description`, and `order`. Folder order is configured in `src/config/nav.ts`.
## Development Checks
```bash
pnpm format
pnpm lint
pnpm exec tsc --noEmit
pnpm test
```
## License
MIT
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

AnvilWiki
AnvilWiki 是一个围绕游戏攻略站场景设计的 Astro 静态模板,目标用户是希望快速搭建游戏内容站、通过 SEO 获取流量并利用广告变现的创作者。
Astro · 游戏站

starlight-theme-rapide
Starlight theme inspired by the Visual Studio Code Vitesse theme
Astro · 文档

CelestialDocs
CelestialDocs 是一个基于 Astro 的文档平台模板,定位是让团队在一个仓库里同时维护文档、博客和产品页面。
Astro · 文档

astro-big-doc
Astro Theme with zero config hierarchical menu and table of content, render pure standard Markdown .md with cu…
Astro · 文档

stellar
Modern type-safe documentation theme for Astro.
Astro · 文档

starlight-theme-black
Starlight theme inspired by @shadcn docs
Astro · 文档
