内容与系列

文章 frontmatter、文件夹式系列、项目链接卡、标签与多语言。

#指南#内容集合

内容位于 src/content/<集合>/<语言>/,frontmatter 在构建期由 src/content.config.ts 校验。

文章 frontmatter#

只有 titledate 是必填:

---
title: "我的第一篇笔记"
description: "用于卡片与页面元信息。"
date: 2026-07-10
tags: [Astro, Markdown]
cover: "https://example.com/cover.jpg"
toc: center
draft: false
---
字段用途
date / updatedDate发布与修订日期
tags归档筛选,自动发现
order系列文件夹内的章节顺序
toccentersidetruefalse
cover卡片与文章页封面
comments单篇评论开关
math, mermaid, gallery, lightbox功能提示

系列就是文件夹#

index.md 拥有同目录 Markdown 兄弟文件的文件夹,就是一个系列——本指南正是如此:

posts/zh-cn/theme-guide/
├── index.md → /zh-cn/posts/theme-guide/
├── site-and-navigation.md → /zh-cn/posts/theme-guide/site-and-navigation/
└── …

项目#

项目是 /projects/ 上的纯 frontmatter 链接卡片——Markdown 正文不会被渲染。links 把自由命名的键映射到 URL;通用键(websitedocsdemo 等)与 Simple Icons 中存在的品牌键会自动匹配图标:

---
title: "Astro Narrow"
description: "一个 Astro-native 内容主题。"
tags: [Astro]
order: 1
links:
github: https://github.com/example/repo
website: https://example.com
---

标签与归档#

标签无需注册表——归档页从已发布文章中自动收集。筛选 URL 可直接分享:/archives/?tag=Astro

多语言#

默认语言(en)不带 URL 前缀;其他语言既是目录名也是 URL 前缀(zh-cn//zh-cn/…)。新增语言时,扩展 src/config/i18n.tslocalesastro.config.mjsi18n.localessrc/content.config.ts 中允许的 lang 值,然后镜像内容目录。

版权许可

CC BY-NC-SA 4.0 许可协议。

相关文章