mobile wallpaper 1mobile wallpaper 2mobile wallpaper 3mobile wallpaper 4mobile wallpaper 5mobile wallpaper 6
914 字
5 分钟
博 客 一 定 要 规 范

写作指南#

受众:Mizuki-Content 内容仓作者(Astro + Mizuki 主题)。 目标:最快写出一篇可发布文章,并掌握本框架的扩展语法(Admonitions、Mermaid、数学公式等)。

1. 最小可用文章#

posts/(或其子目录)创建 .md,写上 frontmatter + 正文。

1.1 最小 Frontmatter#

---
title: 标题
published: 2026-01-01
description: 简短描述
---

1.2 推荐模板#

---
title: "文章标题"
published: 2026-01-20
description: "简短的描述"
image: /images/posts/cover.jpg
tags: [标签1, 标签2]
category: Guides
# updated: 2026-01-21
# author: 作者名
# licenseName: "CC BY-NC-SA 4.0"
# sourceLink: "https://..."
# toc: true
# lang: zh-cn
# pinned: true
# encrypted: true
# password: "your-password"
draft: false
---

2. 文章放哪儿#

  • 文章(Markdown)放在 posts/
  • 可以用子目录组织(推荐:目录文章便于放封面/附件)。

示例:

posts/
├─ my-post.md
└─ guide/
└─ my-post/
├─ cover.png
└─ index.md

3. Frontmatter 字段速查#

说明:字段以现有内容仓文档与示例为准;不同主题/版本可能会扩展更多字段。

3.1 常用字段#

字段含义
title文章标题
published发布日期
description文章摘要(列表页/SEO)
tags标签数组
category分类
image封面图路径
draft草稿(不会显示)
pinned置顶

3.2 可选字段#

字段含义
updated更新日期
author作者
licenseName许可协议名
sourceLink来源/引用链接
keywordsSEO 关键字
toc是否显示目录
lang语言(如 zh-cn/en/ja

3.3 特殊:加密文章#

如需加密文章,设置 encrypted: true 并提供 password

---
title: "私密文章"
published: 2024-01-01
description: "加密内容"
encrypted: true
password: "123456"
draft: false
---

4. 图片与资源#

4.1 封面图 image 三种写法#

image 字段支持 3 种路径规则:

  1. https://... / http://...:外链图片
  2. /...:映射到站点 public 根目录
  3. ./... 或普通相对路径:相对当前 md 文件

示例:

image: "https://example.com/cover.webp" # 外链
image: "/images/posts/cover.jpg" # public/images/posts/cover.jpg
image: "./cover.png" # 与当前 md 同目录

4.2 正文图片#

![图片描述](/images/posts/my-image.jpg)

推荐目录:images/posts/(可再按年份/专题分组)。

5. Markdown 基础#

如果你不熟悉 Markdown,建议先看仓库自带教程:

也可以在本文末尾的「延伸阅读」里继续查看更多示例与文档。

6. Mizuki/Astro 扩展语法(主题特有能力)#

这部分可直接复制示例使用。

6.1 提示块容器(Admonitions)#

支持类型:note tip important warning caution

:::note
提示内容
:::
:::tip
小技巧
:::

自定义标题:

:::note[自定义标题]
这里是带自定义标题的提示块。
:::

6.2 GitHub 提示块语法#

> [!NOTE]
> 这里是 NOTE 内容。
> [!TIP]
> 这里是 TIP 内容。

6.3 GitHub 仓库卡片#

::github{repo="matsuzaka-yuki/Mizuki"}

6.4 折叠(剧透)#

行内 spoiler 短代码:

这里有一段 :spoiler[被隐藏的 **内容**]!

6.5 Mermaid 图表#

使用 fenced code block,并指定语言为 mermaid

graph TD A[开始] --> B[处理] B --> C[结束]

更多示例:Markdown Mermaid

6.6 数学公式(KaTeX)#

  • 行内:$E = mc^2$
  • 块级:
$$
\int_{a}^{b} f(x) \, dx
$$

6.7 视频嵌入(iframe)#

把平台提供的嵌入代码直接粘贴进 Markdown 即可。

<iframe
width="100%"
height="468"
src="https://www.youtube.com/embed/5gIf0_xpFPI?si=N1WTorLKL0uwLsU_"
title="YouTube video player"
frameborder="0"
allowfullscreen
></iframe>

更多示例:视频嵌入示例

7. 草稿与可见性#

如果文章不显示,优先检查:

  • draft: true:草稿不会显示
  • published 在未来:可能会被隐藏

示例:

---
title: Draft Example
published: 2024-01-11T04:40:26.381Z
draft: true
---

8. 常见问题排查#

8.1 封面图不生效#

  • 如果使用 /...,确认该文件实际位于代码仓 public/ 下。
  • 如果使用 ./cover.png,确认图片与 md 文件同目录。

8.2 Mermaid 不渲染#

  • 必须是 fenced code block,且语言标记必须为 mermaid

8.3 公式不渲染#

  • 使用 $...$$$...$$,不要把公式包进普通代码块。

9. 延伸阅读#

说明:以下链接均为内容仓内文件,点击可直接跳转。

9.1 指南#

9.2 示例#

分享

如果这篇文章对你有帮助,欢迎分享给更多人!

博 客 一 定 要 规 范
https://l1ngg.info/posts/guide/howtowrite/
作者
L1ngg
发布于
2026-01-20
许可协议
CC BY-NC-SA 4.0

部分信息可能已经过时

封面
Sample Song
Sample Artist
封面
Sample Song
Sample Artist
0:00 / 0:00