📖 本文共 596 字,阅读需要 2 分钟
默认行为
不写 status 等同于 publish,和以前完全一样:
---
title: 我的文章
slug: my-post
---
支持的四种状态
| status | 效果 | 需要额外字段 |
|---|---|---|
publish |
正常发布,所有人可见 | 无 |
draft |
草稿,仅后台可见 | 无 |
private |
私密,仅管理员可见 | 可加 password |
future |
定时发布,到时间自动公开 | 必须加 date |
示例
草稿
---
title: 还没写完的文章
slug: draft-post
status: draft
---
前台不显示,后台文章列表里能看到。
私密(仅管理员)
---
title: 管理笔记
slug: admin-notes
status: private
---
管理员登录后可见,文章顶部有 🔒 黄色提示条。编辑、作者、访客都看不到。
私密 + 密码保护
---
title: 临时分享
slug: shared-note
status: private
password: onlyme123
---
任何人输入密码 onlyme123 就能访问。
定时发布
---
title: 新年贺文
slug: new-year
status: future
date: 2026-06-01T08:00:00
---
date 必须是 ISO 8601 格式。到时间 WordPress 自动把状态从 future 改为 publish。
发布命令
node publish.js posts/2026/my-post.md
状态字段对文章和页面都生效,写法和发布流程完全一致。
