使用 Astro 与 TypeScript 构建,样式基于 Tailwind,采用组件化布局
blog-template (oyuh) — Astro 作品集模板
作者 oyuh
基于 Astro 的个人博客与作品集模板,源自 Lawson Hart 个人网站,支持文章、笔记内容集合与模板快照导出。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
全部页面与视图 3
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
通过 Content Collections 管理 posts 与 notes 两类内容
文章 frontmatter 支持标签、草稿、封面图、OG 图与 tryLink 等字段
提供模板沙箱与导出脚本,可生成移除私有路径的公开快照
导出流程会强制排除 .env* 文件,避免密钥随快照泄露
代码采用 MIT 许可,允许免费使用、修改、商用与分发
模板详细介绍
该仓库是 lawsonhart.me 博客/文章部分的 Astro 代码库,同时作为可发布复用的轻量博客模板。它使用 Astro 与 TypeScript,通过 Content Collections 管理 posts 与 notes 两类内容,样式基于 Tailwind,并采用组件化布局。仓库内置一套模板沙箱与导出流程:在 template-excludes.txt 中列出私有路径后,可用 bun template:dev 在移除排除项的沙箱副本中预览,再用 node scripts/export-template.cjs 导出过滤后的快照,导出器还会强制排除 .env* 文件。站点配置集中在 src/site.config.ts,需要修改 url、title、author、description 以及导航链接 menuLinks。文章 frontmatter 支持 title、description、publishDate、updatedDate、tags、draft、coverImage、ogImage、tryLink、technologies 等字段。可选集成由 import.meta.env 驱动,涉及评论服务、GitHub 组件与 Umami 分析,相关变量包括 PUBLIC_COMMENTS_API_ORIGIN、PUBLIC_COMMENTS_DEBUG、GITHUB_TOKEN/GITHUB_OWNER/GITHUB_REPO 与 UMAMI_*。
适合你的项目吗?
适用场景
- 搭建个人博客并发布文章与笔记
- 作为个人作品集站点展示项目与关于页面
- 在保留私有集成的前提下导出可公开分享的模板快照
- 基于现有 Astro 项目定制站点元数据与导航结构
适合人群
- 熟悉 Astro 与 TypeScript 的前端开发者
- 需要博客与作品集合一站点的个人用户
- 希望维护私有站点同时对外发布模板的开发者
- 接受使用 bun 作为包管理器的项目
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
需要 Node.js 20+ 与 bun,安装依赖使用 bun install
- 2
bun install 会执行 postinstall 补丁脚本 scripts/patch-astrojs-mdx-server.cjs,属预期行为
- 3
至少需在 src/site.config.ts 中更新 url、title、author、description,并按需调整 menuLinks
- 4
评论、GitHub 组件与 Umami 分析等可选集成需配置对应环境变量,完整列表见 src/env.d.ts
- 5
导出模板前先在 template-excludes.txt 中列出私有路径,并用 bun template:dev 验证
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
- 安装依赖时会自动执行 postinstall 脚本,对 Astro MDX 内部文件打补丁;这是预期行为,但属于对依赖的修改,使用者需知悉。
- 评论功能依赖外部评论服务,需自行配置 PUBLIC_COMMENTS_API_ORIGIN 环境变量指向该服务地址。
- GitHub 组件需要提供 GITHUB_TOKEN、GITHUB_OWNER、GITHUB_REPO 环境变量,涉及 GitHub 账号与访问令牌。
- 分析功能依赖外部 Umami 服务,需配置 UMAMI_* 环境变量后方可启用。
- 导出公开模板前必须手动在 template-excludes.txt 中逐行列出私有路径,否则私有内容可能被包含进快照。
- 导出器会强制排除 .env* 文件,因此导出快照中不包含任何环境变量配置,使用者需自行重新配置。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
`bun install` runs a `postinstall` patch for Astro MDX internals (see `scripts/patch-astrojs-mdx-server.cjs`). That's expected, not something going wrong.
README 原文
- `PUBLIC_COMMENTS_API_ORIGIN`: the comments API origin, if you use the comment service
README 原文
- `GITHUB_TOKEN`, `GITHUB_OWNER`, `GITHUB_REPO`: used for the GitHub-powered widgets
README 原文
- `UMAMI_*`: used for analytics proxying/widgets, if enabled
README 原文
1) Add private paths to `template-excludes.txt` (one workspace-relative path per line)
README 原文
https://github.com/oyuh/blog-template/blob/master/LICENSEhttps://github.com/oyuh/blog-template/blob/master/README.mdThe exporter also hard-excludes any `.env*` files as defense-in-depth, so a stray secret can't ride along in the export.
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-11。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料较完整 · 85 / 100
- 技术栈
- Astro
- 网站类型
- 作品集 · 博客
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2026-10-11
- 截图检查日期
- 2026-10-11
已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。
目录记录的主要技术栈是 Astro。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
审核声明: [email protected] · 2026-10-11
查看当时使用的来源资料
SHA-256: 486be579317f20e4896697c0a8fd817dd317e4cee7b8edf5bf69d172793cbb5d
2026-10-11T11:16:57.183Z
来源文件 / 仓库# blog-template (lawsonhart.me) This is the Astro codebase that powers the blog/posts section of **lawsonhart.me**, and it doubles as a lightweight **blog template** you can publish and reuse. The idea: clone it, customize the site config and content, and when you want to share it, export a "public template snapshot" that leaves the private integrations behind. ## What you get - Astro 5 + TypeScript - Content Collections for posts + notes - Tailwind styling + a component-driven layout - Opinionated linting/formatting (Biome + Prettier) ## Quick start ### Prerequisites - Node.js 20+ (recommended) - bun ### Install ```sh bun install ``` ### Run locally ```sh bun dev ``` Open http://localhost:4321 and you should be looking at the site. ## Scripts The ones you'll actually use day-to-day: - `bun dev` / `bun start` runs the dev server - `bun check` runs `astro check` - `bun lint` runs Biome lint - `bun format` formats code + imports (Biome + Prettier) And the template-focused helpers: - `bun template:dev` runs the site from a sandbox copy with the excluded paths removed - `bun template:build` builds that sandbox copy, which is a nice way to verify the template export won't break One heads-up: `bun install` runs a `postinstall` patch for Astro MDX internals (see `scripts/patch-astrojs-mdx-server.cjs`). That's expected, not something going wrong. ## Configure your site At minimum, update the site metadata in `src/site.config.ts`: - `url` (your domain) - `title`, `author`, and `description` You'll also probably want to adjust the navigation links (`menuLinks`) and rip out any integrations you don't use. ## Site credits The About page includes a short credits section that references: - Built with Astro - Theme base: Astro Cactus It also includes two quick links: - `Info & stats` (internal): `/info-stats` - `Blog template` (external): only shows up when configured via `PUBLIC_TEMPLATE_REPO_URL` ## Content & frontmatter Posts live under `src/content/post/**` and notes live under `src/content/note/**`. Post frontmatter supports: ```yaml title: "Your Post Title" # required description: "Short summary" # required publishDate: "2025-09-01" # required (string or date) updatedDate: 2025-09-15 # optional tags: [astro, webgl] # optional draft: false # optional (defaults false) coverImage: # optional alt: "Alt text" src: ./cover.png ogImage: "/og/custom.png" # optional tryLink: "https://example.app" # optional (adds a "Try it live" button) technologies: [] # optional (Adds the icons of the used technologies) [You must also add them if needed] ``` ## Environment variables Optional integrations are driven by `import.meta.env`. The common ones: - `PUBLIC_COMMENTS_API_ORIGIN`: the comments API origin, if you use the comment service - `PUBLIC_COMMENTS_DEBUG`: enables client-side debug logging for comments - `GITHUB_TOKEN`, `GITHUB_OWNER`, `GITHUB_REPO`: used for the GitHub-powered widgets - `UMAMI_*`: used for analytics proxying/widgets, if enabled See `src/env.d.ts` for the full list. ## Template sandbox + exporting This is how the repo keeps the **real site** private while still producing a safe-to-publish **template snapshot**. 1) Add private paths to `template-excludes.txt` (one workspace-relative path per line) 2) Validate the template view: ```sh bun template:dev ``` 3) Export a filtered snapshot: ```sh node scripts/export-template.cjs --out .template-export ``` The exporter also hard-excludes any `.env*` files as defense-in-depth, so a stray secret can't ride along in the export. ## License MIT, see LICENSE.
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

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 · 作品集
