属性(在Obsidian中)
1. 基础展示(4 个)
| 属性 |
怎么写 |
谁读它 |
效果 |
title |
title: 我的第一篇 |
article-title / Head / 探索栏 |
页面大标题、浏览器标签、列表里显示的名字(不写则用文件名) |
description |
description: 一句话说清这篇讲什么 |
description / og-image |
属性面板、搜索摘要、<meta name="description"> |
tags |
tags: [随笔, Quartz](必须数组) |
tag-page / tag-list / content-index |
生成 /tags/随笔 标签页;has-tags 条件也靠它 |
aliases |
aliases: [/old-path, 旧标题] |
alias-redirects |
访问旧路径自动跳到本页 |
2. 语言与样式(2 个)
| 属性 |
怎么写 |
谁读它 |
效果 |
lang |
lang: en |
核心 renderPage |
覆盖本页 <html lang>(站点默认取 locale) |
cssclasses |
cssclasses: [wide, no-toc] |
content-page / folder-page / tag-page |
给页面容器加 CSS 类,配合 quartz/styles/custom.scss 写样式 |
3. 日期(3 个)
| 属性 |
怎么写 |
谁读它 |
效果 |
created |
created: 2026-10-01 |
created-modified-date |
创建日期(优先于 git / 文件时间) |
modified |
modified: 2026-10-05 |
created-modified-date |
修改日期 ← 你现在显示和排序用的就是它 |
published |
published: 2026-10-05 |
created-modified-date |
发布日期(把配置里 defaultDateType 改成 published 才会显示/排序用它) |
写法:2026-10-05 或带时间 2026-10-05T09:30:00+08:00。Obsidian 常见的 date: 字段 Quartz 不读。 |
|
|
|
4. 页面显示开关(2 个)
| 属性 |
怎么写 |
谁读它 |
效果 |
enableToc |
enableToc: false |
table-of-contents |
单页关掉右侧目录(写 true 强制开) |
comments |
comments: false |
comments |
单页关掉评论区(写 true 强制开) |
5. 可见性与权限(5 个)
| 属性 |
怎么写 |
谁读它 |
效果 |
draft |
draft: true |
remove-draft |
完全不构建(访问该页 404,列表/搜索里也没有) |
unlisted |
unlisted: true |
unlisted-pages(+ encrypted-pages) |
页面照常生成,但不进探索栏/搜索/图谱/RSS/sitemap/最近笔记,直链仍可访问 |
password |
password: 你的密码 |
encrypted-pages |
页面加密,打开需输密码(字段名由配置里 passwordField 决定,当前就是 password) |
stealth |
stealth: true |
encrypted-pages |
加密页进阶版:同时设为不列出(要配 password 一起用) |
publish |
publish: true |
explicit-publish |
白名单发布:只有写了才发布 该插件你现在是关的,写了不生效(关 = 全部发布) |
6. 分享卡片(2 个)
| 属性 |
怎么写 |
谁读它 |
效果 |
socialImage |
socialImage: /static/cover.png(或完整 URL) |
og-image |
自定义分享图;写了就不再自动生成 OG 图 |
socialDescription |
socialDescription: 分享到社交平台的文案 |
og-image / Head |
分享卡片的描述,优先于 description |
一个完整可抄的示例
yaml
---
title: 我的第一篇博客
description: 记录我用 Quartz 搭博客的过程。
tags: [随笔, Quartz]
aliases: [/hello, 第一篇]
lang: zh-CN
cssclasses: [wide]
created: 2026-10-01
modified: 2026-10-05
published: 2026-10-05
enableToc: true
comments: true
socialDescription: 分享到社交平台时显示的文案
---
正文……
按需加(默认不用写):
yaml
draft: true # 还没写完 → 不生成
unlisted: true # 写完但不想被翻到 → 生成但隐藏
password: demo123 # 要密码才能看
publish: true # 仅在打开 explicit-publish 后才需要
socialImage: https://example.com/cover.png
六个必须注意的点
- 属性名大小写必须完全一致:
enableToc、cssclasses、socialImage 这些写成 enable_toc / CSSClasses 都不会生效(插件按精确名字读取)。
tags 一定要写成数组:has-tags 条件用的是 Array.isArray(tags),写成 tags: 随笔(单值)会让"只在有标签时显示"这类条件失效。
- 布尔值不带引号最稳:
draft: true
。draft/publish 额外接受字符串 "true",但 unlisted/stealth 是严格判断,写 "true" 不算。
draft 和 unlisted 不是一回事:draft = 连 HTML 都不生成;unlisted = 生成但不列出(有直链就能看)。
password/stealth 不是真机密保护:密文文件是公开可下载的,安全性取决于密码强度。
- 写别的属性(比如
mood: 开心)不会报错,但会被忽略——除非把它加进 quartz.config.yaml 里 note-properties 的 includedProperties,那样才会显示在页面顶部的属性面板里。
对照关系:上面每个"谁读它"都能在上一份 47 个 source 表里找到对应插件;想知道某个插件的更多选项,看 node_modules/@quartz-community/<名字>/README.md。