使用 Astro Content Collections 管理博客文章与项目,frontmatter 带类型定义
baselayer — Astro 作品集模板
作者 baflow
Baselayer 是一个基于 Astro 与 Svelte 的深色模式博客与作品集启动模板,内置内容集合、设计令牌主题,并提供可选的 Cloudflare Worker 联系表单方案。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
全部页面与视图 3
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
设计令牌驱动的 Tailwind 主题,颜色、字体与间距集中在一处调整
Astro 与 Svelte 组件混合,配合 Basecoat CSS 与 Solar 图标
内置 RSS、Sitemap 与 Open Graph 输出,代码块由 Expressive Code 渲染
可选联系表单:独立部署的 Cloudflare Worker 经 Resend 转发邮件,支持 Turnstile 与速率限制
模板详细介绍
Baselayer 是面向开发者的 Astro 启动模板,用于搭建深色模式的博客与产品展示站点。它使用 Astro 的 Content Collections 管理博客文章与项目条目,frontmatter 带类型定义;主题由设计令牌驱动,颜色、字体与间距集中在单一来源中调整。UI 组件由 Astro 与 Svelte 构成,并引入 Basecoat CSS 与 Solar 图标,字体使用 Inter 与 Newsreader。模板自带 RSS、Sitemap 与 Open Graph 输出,代码块使用 Expressive Code 渲染。
联系表单为可选功能,通过独立的 Cloudflare Worker 实现:该 Worker 以 git submodule 形式放在 integrations/email-cloudflare-resend/,单独部署,负责校验提交并通过 Resend 转发邮件,可配置 Turnstile 校验、按 IP 的速率限制与发件域限制。前端通过 EMAIL_WORKER_URL 指向该 Worker。
使用前需要手动完成若干配置:在 astro.config.mjs 中设置站点 URL,在 src/consts.ts 更新标题、描述与联系链接,替换 Footer.astro 中的页脚文本,向 src/content/blog/ 与 src/content/projects/ 添加内容,并替换 public/thumbnail.png。若启用联系表单,还需初始化 submodule、安装依赖、在 wrangler.toml 与 .env 中配置变量和密钥,并分别部署 Worker 与站点。
适合你的项目吗?
适用场景
- 搭建个人开发者博客,用 Markdown/MDX 写文章并自动生成 RSS 与 Sitemap
- 制作产品展示或作品集页面,用内容集合维护项目条目
- 需要一个带联系表单的静态站点,并愿意单独部署 Cloudflare Worker 处理邮件
- 希望以设计令牌统一控制深色主题的配色、字体与间距
适合人群
- 熟悉 Astro 与 Svelte,愿意按文档手动配置站点信息与内容的开发者
- 需要深色模式博客或作品集起步模板的个人开发者
- 能接受将联系表单拆分为独立 Cloudflare Worker 部署的用户
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
克隆后执行 npm install 与 npm run dev 启动本地开发
- 2
在 astro.config.mjs 设置 site URL,在 src/consts.ts 更新标题、描述与联系链接,并替换 Footer.astro 页脚文本
- 3
向 src/content/blog/ 与 src/content/projects/ 添加内容,并替换 public/thumbnail.png(建议 1200x630)
- 4
启用联系表单需初始化 git submodule(git submodule update --init),在 integrations/email-cloudflare-resend/ 内安装依赖并配置 wrangler.toml
- 5
为 Worker 设置 RESEND_API_KEY 与 TURNSTILE_SECRET 等密钥,部署后在 .env 中填写 EMAIL_WORKER_URL 与 EMAIL_RECIPIENT
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
- 联系表单为可选功能,启用后需使用 Cloudflare Workers 与 Resend API 等外部服务。
- 联系表单依赖独立仓库的 Cloudflare Worker,需单独部署,不属于本模板主站代码。
- 启用邮件功能需自行申请并配置 Resend API 密钥。
- 启用邮件功能需配置 Cloudflare Turnstile 密钥。
- 速率限制依赖 Cloudflare KV 命名空间绑定,需在 Cloudflare 账户中创建。
- 可通过 EMAIL_ENABLED 变量关闭邮件发送接口。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
**Optional contact form** — Cloudflare Workers + Resend API
README 原文
The submodule points to [`email-cloudflare-resend`](https://github.com/baflow/email-cloudflare-resend) — a standalone Cloudflare Worker that acts as a secure email proxy (Turnstile, rate limiting, Resend relay). It is **deployed separately** from the Astro site.
README 原文
| `RESEND_API_KEY` | Secret | `wrangler secret put RESEND_API_KEY` | Resend API bearer token |
README 原文
| `TURNSTILE_SECRET` | Secret | `wrangler secret put TURNSTILE_SECRET` | Cloudflare Turnstile site secret |
README 原文
| `RATE_LIMIT_KV` | KV binding | `wrangler.toml` (`[[kv_namespaces]]`) | KV namespace for rate-limit storage |
README 原文
https://github.com/baflow/baselayer/blob/main/LICENSEhttps://github.com/baflow/baselayer/blob/main/README.md| `EMAIL_ENABLED` | Variable | `wrangler.toml` (`[vars]`) | Set `false` to disable `/send` (returns `503`) |
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-05。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料较完整 · 88 / 100
- 技术栈
- Astro · Svelte
- 网站类型
- 作品集 · 博客 · 启动器
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2026-05-13
- 截图检查日期
- 2026-10-05
已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。
目录记录的主要技术栈是 Astro。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
审核声明: [email protected] · 2026-10-05
查看当时使用的来源资料
SHA-256: 466551fbc5d3788e20133ad78ca50a2faa14310f7e48805ae137fe2d3d7292c4
2026-10-05T01:00:28.175Z
来源文件 / 仓库# Astro Dev Template [](https://astro.build) [](https://tailwindcss.com) [](https://svelte.dev) [](./LICENSE) > A free, design-token-driven Astro 6 starter for dark-mode blogs and product showcases. **[Live Demo](https://baselayer-pk4.pages.dev/)**  --- ## One-Click Deploy Deploy your own copy in under 2 minutes: [](https://vercel.com/new/clone?repository-url=https://github.com/baflow/baselayer) [](https://app.netlify.com/start/deploy?repository=https://github.com/baflow/baselayer) Or use the CLI: ```bash # Clone git clone https://github.com/baflow/baselayer.git my-site cd my-site # Install & dev npm install npm run dev ``` --- ## Stack Built with **Astro 6**, **Tailwind CSS v4**, **Basecoat CSS**, **Svelte 5**, Solar icons, and Inter + Newsreader fonts. Deploys to Cloudflare Pages. --- ## Features - **Content Collections** with typed frontmatter for blog posts and projects - **Design-token-driven** Tailwind theme — tweak colors, typography, and spacing through a single source of truth - **Basecoat UI** — debloated components, no React needed - **Expressive Code** for beautiful fenced code blocks - **RSS, Sitemap, Open Graph** out of the box, thanks to Astro - **Optional contact form** — Cloudflare Workers + Resend API --- ## Project Structure ```text ├── public/ # Static assets ├── src/ │ ├── assets/ # Images processed by Astro │ ├── components/ # Astro + Svelte UI components │ │ └── ui/ # Reusable Svelte components │ ├── content/ # Markdown/MDX collections │ ├── layouts/ # Page layouts │ ├── pages/ # File-based routes │ ├── styles/ # Tailwind theme + Basecoat imports │ └── types/ # Local type definitions ├── integrations/ # Git submodules (optional) │ └── email-cloudflare-resend/ # Email worker (separate deploy) ├── scripts/ # Dev / deploy helpers ├── DESIGN.md # Design system spec ├── astro.config.mjs ├── wrangler.toml └── README.md ``` --- ## Before you publish your site 1. **Set your site URL** in `astro.config.mjs`: ```js site: 'https://your-domain.com', ``` 2. **Update placeholders** in `src/consts.ts` (title, description, contact links). 3. **Replace the footer** text in `src/components/Footer.astro`. 4. **Add your own content** to `src/content/blog/` and `src/content/projects/`. 5. **Replace thumbnail** — add `public/thumbnail.png` (1200x630 recommended). 6. **Configure Wrangler** (optional) in `wrangler.toml` and `.env`. 7. **Update repo URL** in the deploy buttons above. --- ## Git Submodules This template uses a **git submodule** for the email worker so it can evolve independently while remaining version-pinned here. ```bash # After cloning, initialise the submodule git submodule update --init # The submodule is mounted at: # integrations/email-cloudflare-resend/ ``` The submodule points to [`email-cloudflare-resend`](https://github.com/baflow/email-cloudflare-resend) — a standalone Cloudflare Worker that acts as a secure email proxy (Turnstile, rate limiting, Resend relay). It is **deployed separately** from the Astro site. The frontend talks to it via `EMAIL_WORKER_URL`. --- ## Email Worker (submodule) The worker lives in `integrations/email-cloudflare-resend/` (git submodule). It validates contact-form submissions from the static Astro site and relays them in a secure way through **Resend**. ### Required secrets & variables (inside submodule) | Name | Type | How to set | Purpose | |------|------|------------|---------| | `RESEND_API_KEY` | Secret | `wrangler secret put RESEND_API_KEY` | Resend API bearer token | | `TURNSTILE_SECRET` | Secret | `wrangler secret put TURNSTILE_SECRET` | Cloudflare Turnstile site secret | | `RATE_LIMIT_KV` | KV binding | `wrangler.toml` (`[[kv_namespaces]]`) | KV namespace for rate-limit storage | | `SENDER_DOMAIN` | Variable | `wrangler.toml` (`[vars]`) | Allowed sender domain | | `RATE_LIMIT_MAX` | Variable | `wrangler.toml` (`[vars]`) | Max requests per IP (default `2`) | | `RATE_LIMIT_WINDOW_MINUTES` | Variable | `wrangler.toml` (`[vars]`) | Sliding window in minutes (default `15`) | | `EMAIL_ENABLED` | Variable | `wrangler.toml` (`[vars]`) | Set `false` to disable `/send` (returns `503`) | ### Quick start 1. **Initialise the submodule** (if you haven't yet): ```bash git submodule update --init ``` 2. **Install & configure** inside the submodule: ```bash cd integrations/email-cloudflare-resend npm install ``` Edit `wrangler.toml` with your `SENDER_DOMAIN` and create a KV namespace if needed. 3. **Add secrets**: ```bash npx wrangler secret put RESEND_API_KEY npx wrangler secret put TURNSTILE_SECRET ``` 4. **Deploy**: ```bash npm run email:deploy # or manually: cd integrations/email-cloudflare-resend && npx wrangler deploy ``` 5. **Wire the frontend** — set the worker URL in `.env`: ```bash EMAIL_WORKER_URL=https://email-cloudflare-resend.<subdomain>.workers.dev/send [email protected] ``` --- ## Contributing Feature requests and PRs are welcome. See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines. --- ## License MIT -- free for personal and commercial use.
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

astrowind
⭕️ AstroWind: A free template using Astro v7 and Tailwind CSS v4. Astro starter theme.
Astro · 博客

astro-paper
A minimal, accessible and SEO-friendly Astro blog theme.
Astro · 博客

fuwari
✨A static blog template built with Astro.
Astro · 博客

Firefly
Firefly 是一款基于 Astro 的静态博客主题,由 CuteLeaf 在 saicaca 的 Fuwari 模板基础上二次开发,主打清新美观的视觉风格。
Astro · 博客

astro-theme-cactus
A simple Astro theme. Use it to create your blog or website.
Astro · 作品集

astrofy
Astrofy is a free and open-source template for your Personal Portfolio Website built with Astro and TailwindCS…
Astro · 作品集
