Skip to main content

起草并发布

¥Draft & Publish

草稿和发布功能允许管理内容的草稿。

¥The Draft & Publish feature allows to manage drafts for your content.

功能的身份证

计划:免费功能。
角色和权限:无。
激活:可用但默认禁用。
环境:在开发和生产环境中均可用。

¥ Plan: Free feature.
Role & permission: None.
Activation: Available but disabled by default.
Environment: Available in both Development & Production environment.

Editing draft versionEditing draft version

配置

¥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.

  1. 编辑所选已创建的内容类型,或创建新的内容类型(有关更多信息,请参阅 内容类型 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).

  2. 转到高级设置选项卡。

    ¥Go to the Advanced settings tab.

  3. 勾选草稿和发布选项。

    ¥Tick the Draft & Publish option.

  4. 单击“完成”按钮。

    ¥Click the Finish button.

Content-type Builder's advanced settingsContent-type Builder's advanced settings

用法

¥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.

Editing draft versionEditing draft 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.

Editing published versionEditing published version
提示

要安排发布(即在给定日期和时间将草稿转换为已发布的条目),你可以将其包含在发布中并安排该发布的发布。有关更多信息,请参阅 发布功能 文档。

¥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.

取消发布内容

¥Unpublishing content

路径: 内容管理器,内容类型的编辑视图

¥Path: Content Manager, edit view of your content type

要取消发布之前发布的内容:从草稿选项卡中,单击界面右侧输入框中的 ,然后选择取消发布按钮。

¥To unpublish a previously published content: from the Draft tab, click on in the Entry box on the right side of the interface and choose the Unpublish button.

如果文档的草稿版本包含与已发布版本不同的内容,你可以决定在取消发布时如何处理这两种内容:

¥If the draft version of the document contains content different from the published version, you can decide what to do with both content when unpublishing:

  1. 从草稿选项卡中,点击界面右侧输入框中的 ,然后选择取消发布按钮。

    ¥From the Draft tab, click on in the Entry box on the right side of the interface and choose the Unpublish button.

  2. 在打开的确认对话框中,你可以选择:

    ¥In the Confirmation dialog that opens, you can choose to:

    • 取消发布并保留最后的草稿,这样你当前在草稿选项卡中的所有内容都会保留,但已发布选项卡中的所有内容肯定会消失

      ¥Unpublish and keep last draft, so that all the content you currently have in the Draft tab is preserved, but the all the content from the Published tab is definitely gone

    • 取消发布并替换最后的草稿以丢弃草稿选项卡中的任何现有内容并将其替换为已发布选项卡中所有字段的内容

      ¥Unpublish and replace last draft to discard any existing content in the Draft tab and replace it with the content of all fields from the Published tab

  3. 单击确认。所需的更改将应用​​于“草稿”和“已发布”选项卡,条目的新状态也将反映在条目标题下方。

    ¥Click Confirm. The desired changes will be applied to both the Draft and Published tabs and the new status of the entry will also be reflected below the entry title.

Unpublish a documentUnpublish a document

批量操作

¥Bulk actions

路径: 内容管理器,内容类型的列表视图

¥Path: Content Manager, list view of your content type

内容管理器的列表视图 中选择多个条目将显示其他按钮,以同时发布或取消发布多个条目。这就是所谓的 "批量发布/取消发布"。

¥Selecting multiple entries from the Content Manager's list view will display additional buttons to publish or unpublish several entries simultaneously. This is what is called "bulk publishing/unpublishing".

提醒

如果安装了 国际化功能,批量发布/取消发布操作仅适用于当前选择的区域设置。

¥If the Internationalization feature is installed, the bulk publish/unpublish actions only apply to the currently selected locale.

Unpublish a documentUnpublish a document

批量发布草稿

¥Bulk publishing drafts

要同时发布多个条目:

¥To publish several entries at the same time:

  1. 从内容管理器的列表视图中,通过勾选条目记录左侧的框来选择要发布的条目。

    ¥From the list view of the Content Manager, select your entries to publish by ticking the box on the left side of the entries' record.

  2. 单击位于表标题上方的“发布”按钮。

    ¥Click on the Publish button located above the header of the table.

  3. 在“发布条目”对话框中,检查所选条目的列表及其状态:

    ¥In the Publish entries dialog, check the list of selected entries and their status:

    • 准备发布:该条目可以发布

      ¥ Ready to publish: the entry can be published

    • "[字段名称] 为必填项"、"[字段名称]太短" 或 "[字段名称]太长":由于红色警告消息中指出的问题,该条目无法发布。

      ¥ "[field name] is required", "[field name] is too short" or "[field name] is too long": the entry cannot be published because of the issue stated in the red warning message.

  4. (可选)如果你的某些条目具有 状态,请单击 编辑按钮来修复问题,直到所有条目都具有 准备发布状态。请注意,在修复各种条目问题时,你必须单击“刷新”按钮来更新“发布条目”对话框。

    ¥(optional) If some of your entries have a status, click the edit buttons to fix the issues until all entries have the Ready to publish status. Note that you will have to click on the Refresh button to update the Publish entries dialog as you fix the various entries issues.

  5. 单击发布按钮。

    ¥Click the Publish button.

  6. 在确认对话框中,再次单击“发布”按钮确认你的选择。

    ¥In the confirmation dialog box, confirm your choice by clicking again on the Publish button.

批量取消发布内容

¥Bulk unpublishing content

要同时取消发布多个条目:

¥To unpublish several entries at the same time:

  1. 从内容管理器的列表视图中,通过勾选条目记录左侧的框来选择要取消发布的条目。

    ¥From the list view of the Content Manager, select your entries to unpublish by ticking the box on the left side of the entries' record.

  2. 单击位于表标题上方的“取消发布”按钮。

    ¥Click on the Unpublish button located above the header of the table.

  3. 在确认对话框中,再次单击“取消发布”按钮确认你的选择。

    ¥In the confirmation dialog box, confirm your choice by clicking again on the Unpublish button.

使用 API

¥Usage with APIs

可以通过从 Strapi 的内容 API 访问的各种前端 API 使用 status 参数请求、创建、更新和删除草稿或已发布的内容:

¥Draft or published content can be requested, created, updated, and deleted using the status parameter through the various front-end APIs accessible from Strapi's Content API:

在 Strapi 的后端服务器上,文档服务 API 还可用于与本地化内容进行交互:

¥On the back-end server of Strapi, the Document Service API can also be used to interact with localized content: