Skip to main content

保存、发布和删除内容

¥Saving, publishing and deleting content

Strapi 允许你在内容的整个生命周期中管理内容,无论你是正在处理其草稿版本、即将完成它并与世界分享,还是想要在其过时时将其删除。

¥Strapi allows you to manage your content throughout its whole lifecycle, whether you are working on its draft version, about to finish it and share it with the world, or wanting to delete it when it's obsolete.

保存和发布内容

¥Saving & publishing content

提醒

管理内容草稿的可能性来自草稿和发布功能。此功能默认激活,但可以从内容类型构建器(参见 内容类型的高级设置)中为任何内容类型停用此功能。如果你禁用了“草稿和发布”功能,则保存内容意味着同时保存和发布。

¥The possibility to manage drafts for contents comes from the Draft & Publish feature. This feature is activated by default, but it can be deactivated for any content-type from the Content-type Builder (see advanced settings for content-types). If you disabled the Draft & Publish feature, saving your content means saving and publishing at the same time.

你的内容可以有 3 种状态:

¥Your content can have 3 statuses:

状态名称描述
\已发布内容之前已发布。
没有保存待处理的草稿更改。
\已修改内容之前已发布。
你对草稿版本进行了一些更改并保存了这些更改,但更改尚未发布。
\草稿内容从未发布过。

在内容管理器编辑视图(编辑条目时看到的视图)中,条目的当前状态显示在界面顶部,就在条目标题下方。

¥In the Content Manager edit view (the view you see when editing an entry), the current status of an entry is indicated at the top of the interface, just below the entry title.

Editing draft versionEditing draft version

使用草稿

¥Working with drafts

在编辑文档时,你可以看到 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

More icon

并选择

¥and choosing

Discard changes icon

放弃更改。

¥Discard changes.

发布和取消发布

¥Publishing and unpublishing

在编辑文档时,你可以决定发布草稿或取消发布以前发布的内容。

¥While editing a document, you can decide to publish a draft or unpublish previously published content.

发布草稿

¥Publishing a draft

要发布草稿,请单击界面右侧输入框中的发布按钮。

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

取消发布内容

¥Unpublishing content

按 接受所有问题的默认答案。

¥Previously published content can be unpublished.

要取消发布内容,请在“草稿”选项卡中单击

¥To unpublish content, from the Draft tab, click on

More icon

在界面右侧的条目框中,然后选择取消发布按钮。

¥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

More icon

在界面右侧的条目框中,然后选择取消发布按钮。2.* 取消发布并保留最后一份草稿,这样你当前在“草稿”选项卡中的所有内容都会保留,但“已发布”选项卡中的所有内容肯定会消失 - 取消发布并替换上一个草稿以丢弃“草稿”选项卡中的任何现有内容并将其替换为“已发布”选项卡 3 中所有字段的内容。单击确认。所需的更改将应用​​于“草稿”和“已发布”选项卡,条目的新状态也将反映在条目标题下方。

¥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
  1. 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 publishing and unpublishing

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

¥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 plugin 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:

    • Success icon

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

¥Ready to publish: the entry can be published

Fail icon

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

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

  1. (可选)如果你的某些条目有

    ¥(optional) If some of your entries have a

Edit icon

状态,单击

¥status, click the

Edit icon

编辑按钮来修复问题,直到所有条目都有

¥edit buttons to fix the issues until all entries have the

Success icon

准备发布状态。请注意,在修复各种条目问题时,你必须单击“刷新”按钮来更新“发布条目”对话框。5.6.

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

删除内容

¥Deleting content

你可以通过删除集合类型的任意条目或单一类型的默认条目来删除内容。

¥You can delete content by deleting any entry of a collection type, or the default entry of a single type.

  1. 在条目的编辑视图中,单击

    ¥In the edit view of the entry, click on

More icon

在界面的右上角,然后单击删除文档按钮。
如果内容类型启用了国际化,你还可以选择仅删除当前选定的语言环境,方法是单击删除语言环境按钮。2.

¥at the top right of the interface, and click the Delete document button.
If Internationalization is enabled for the content-type, you can also choose to delete only the currently selected locale by clicking on the Delete locale button. 2. In the window that pops up, click on the Confirm button to confirm the deletion.

💡 提示

你可以通过单击从集合类型的列表视图中删除条目

¥You can delete entries from the list view of a collection type, by clicking on

More icon

在表中条目记录的右侧,然后选择

¥on the right side of the entry's record in the table, then choosing the

Delete icon

删除文档按钮。
如果内容类型启用了国际化,则删除文档会删除所有语言环境,而删除语言环境只会删除当前列出的语言环境。

¥Delete document button.
If Internationalization is enabled for the content-type, Delete document deletes all locales while Delete locale only deletes the currently listed locale.