主题上手指南
创建新文章 执行 pnpm new-post
pnpm new-post -> src/content/posts/new-post.md pnpm new-post first-post -> src/content/posts/first-post.md pnpm new-post 2025/03/first-post -> src/content/posts/2025/03/first-post.md pnpm new-post first-post.mdx -> src/content/posts/first-post.mdx Front Matter title 和 published 为必填项,其余配置均可删除。
必填
title: 主题上手指南 published: 2025-01-26
可选
description: 自动选取文章前 120 字作为摘要。 updated: 2025-03-26 tags:
- 博客主题
- 指南
进阶,可选
draft: true/false pin: 0-99 toc: true/false lang: de/en/es/fr/ja/ko/pl/pt/ru/zh/zh-tw abbrlink: theme-guide
进阶配置 draft 是否标记文章为草稿。设为 true 时无法发布文章,仅供本地开发预览。默认为 false。
pin 是否置顶文章。数字越大,文章的置顶优先级越高。默认为 0,即不置顶。
toc 是否生成目录。显示 h2 至 h4 标题。默认由全局配置项 global.toc 决定,可在文章中单独设置以覆盖全局配置。
lang 指定文章语言。只能指定一种语言,不指定则默认显示在所有语言路径下。
src/config.ts
locale: ‘en’
moreLocales: [‘es’, ‘ru’]
lang: ”
src/content/posts/apple.md -> example.com/posts/apple/ -> example.com/es/posts/apple/ -> example.com/ru/posts/apple/
lang: en
src/content/posts/apple.md -> example.com/posts/apple/
lang: es
src/content/posts/apple.md -> example.com/es/posts/apple/
lang: ru
src/content/posts/apple.md -> example.com/ru/posts/apple/ abbrlink 自定义文章 URL。只能包含小写字母、数字和连字符 -。
src/config.ts
locale: ‘en’
moreLocales: [‘es’, ‘ru’]
lang: ‘es’
abbrlink: ”
src/content/posts/apple.md -> example.com/es/posts/apple/ src/content/posts/guide/apple.md -> example.com/es/posts/guide/apple/ src/content/posts/2025/03/apple.md -> example.com/es/posts/2025/03/apple/
abbrlink: ‘banana’
src/content/posts/apple.md -> example.com/es/posts/banana/ src/content/posts/guide/apple.md -> example.com/es/posts/banana/ src/content/posts/2025/03/apple.md -> example.com/es/posts/banana/ 混排优化 执行 pnpm format-posts,可优化 src/content/ 目录中 Markdown 文件的排版格式。在 CJK(中文、日文、韩文)与英文混写的场景下,补充正确的空格,纠正标点符号等。
pnpm format-posts 🔍 Scanning Markdown files… 📦 Found 56 Markdown files ✅ src/content/posts/guides/Theme Guide-ja.md ✅ src/content/posts/guides/Theme Guide-zh-tw.md ✅ src/content/posts/guides/Theme Guide-zh.md ✨ Formatted 3 files successfully