起草并发布
¥Draft & Publish
Page summary:
Draft & Publish separates drafts from live entries, allowing editors to stage content before release. This documentation shows how to enable it per content type and manage publish or unpublish actions.
草稿和发布功能允许管理内 容的草稿。
¥The Draft & Publish feature allows to manage drafts for your content.
配置
¥Configuration
配置功能的路径: 内容类型生成器
¥Path to configure the feature: Content Type Builder
要使用内容管理器中的草稿和发布来管理你的内容类型,必须通过内容类型构建器启用该功能。可以为每种内容类型配置草稿和发布。
¥For your content types to be managed with Draft & Publish in the Content Manager, the feature must be enabled through the Content-type Builder. Draft & Publish can be configured for each content type.
-
编辑所选已创建的内容类型,或创建新的内容类型(有关更多信息,请参阅 内容类型 Builder 文档)。
¥Either edit an already created content type of your choice, or create a new content type (see Content Type Builder documentation for more information).
-
转到高级设置选项卡。
¥Go to the Advanced settings tab.
-
勾选草稿和发布选项。
¥Tick the Draft & Publish option.
-
单击“完成”按钮。
¥Click the Finish button.

记录首次发布日期 experimental_firstPublishedAtThis feature requires the experimental_firstPublishedAt feature flag to be enabled.
¥Recording the first publication date experimental_firstPublishedAtThis feature requires the experimental_firstPublishedAt feature flag to be enabled.
启用此未来标志后(参见 功能配置),Strapi 会自动将 firstPublishedAt 属性添加到所有使用“草稿”和“发布”模式的内容类型。该属性保存条目首次发布的日期和时间,即使条目取消发布并再次发布,该属性也不会更改。
¥When this future flag is enabled (see features configuration), Strapi automatically adds a firstPublishedAt attribute to all content-types that use Draft & Publish. The attribute saves the date and time when an entry is first published and never changes even if the entry is unpublished and published again.
如果该功能标志稍后被禁用,firstPublishedAt 属性及其存储的值将被删除。
¥If the feature flag is disabled later, the firstPublishedAt attribute and its stored values are removed.
用法
¥Usage
启用草稿和发布后,内容管理器的编辑视图 会在界面顶部指示内容类型条目的当前状态。你的内容可以有 3 种状态:
¥With Draft & Publish enabled, the Content Manager's edit view indicates the current status of your content type's entry at the top of the interface. Your content can have 3 statuses:
-
已发布:内容之前已发布。没有保存待处理的草稿更改。
¥Published: The content was previously published. There are no pending draft changes saved.
-
已修改:内容之前已发布。你对草稿版本进行了一些更改并保存了这些更改,但这些更改尚未发布。
¥Modified: The content was previously published. You made some changes to the draft version and saved these changes, but the changes have not been published yet.
-
草稿:内容从未发布过。
¥Draft: The content has never been published yet.
使用草稿
¥Working with drafts
路径: 内容管理器,内容类型的编辑视图
¥Path: Content Manager, edit view of your content type
在编辑文档时,你可以看到 2 个选项卡:
¥While editing a document, you can see 2 tabs:
-
你可以在草稿选项卡中编辑内容。
¥The Draft tab is where you can edit your content.
-
“已发布”选项卡是一个只读选项卡,其中禁用所有字段的编辑。“已发布”选项卡仅用于显示已发布版本中字段的内容。
¥The Published tab is a read-only tab where edition of all fields is disabled. The Published tab only exists to show what is the content of fields in the published version.

默认情况下,每个新创建的内容都是草稿。可以使用界面右侧输入框中的保存按钮随意修改和保存草稿,直到它们准备好发布。
¥By default, each newly created content is a draft. Drafts can be modified and saved at will, using the Save button in the Entry box on the right side of the interface, until they are ready to be published.
对草稿进行更改后,你有 3 个可能的选项,所有选项均可在界面右侧的输入框中找到:
¥Once you made changes to a draft, you have 3 possible options, all available in the Entry box on the right side of the interface:
-
提供程序实例(操作提供程序、条件提供程序等)是使用提供程序工厂构建的。
¥Publish your document (see Publishing a draft),
-
保存草稿以供日后检索,
¥Save your draft for later retrieval,
-
或者放弃更改,方法是单击 并选择 放弃更改。
¥or discard changes, by clicking on and choosing Discard changes.
发布草稿
¥Publishing a draft
路径: 内容管理器,内容类型的编辑视图
¥Path: Content Manager, edit view of your content type
要发布草稿,请单击界面右侧输入框中的发布按钮。
¥To publish a draft, click on the Publish button in the Entry box on the right side of the interface.
草稿发布后:
¥After a draft is published:
-
草稿和已发布选项卡的内容应完全相同(但已发布选项卡保持只读)。
¥The content of the Draft and Published tabs should be exactly the same (but the Published tab remains read-only).
-
文档标题下方的状态将切换为 "已发布"。
¥The status, below the document's title, will switch to "Published".
在发布草稿之前,请确保它与其他未发布的内容没有关系,否则某些内容可能无法通过 API 访问。
¥Before publishing a draft, make sure it doesn't have relations with other non-published content, otherwise some of the content may not be available through the API.
当文档同时具有草稿和已发布版本时,可以在“已发布”选项卡中找到已发布版本。如果文档只有草稿版本,则无法单击“已发布”选项卡。
¥When a document has both a draft and a published version available, the published version can be found in the Published tab. If the document has only a draft version, you can not click on the Published tab.

要安排发布(即在给定日期和时间将草稿转换为已发布的条目),你可以将其包含在发布中并安排该发布的发布。有关更多信息,请参阅 发布功能 文档。
¥To schedule publication (i.e. convert a draft to a published entry at a given date and time) you can include it in a release and schedule the publication of that release. Please refer to the Releases feature documentation for more information.