Skip to main content

禁用草稿和发布的内容类型始终将 postedAt 值设置为日期

¥Content types with Draft & Publish disabled always have the publishedAt value set to a date

在 Strapi 5 中,禁用草稿和发布的内容类型的 postedAt 值始终设置为日期。

此页面是 重大变更数据库 的一部分,提供有关重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的其他说明。

¥This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

¥In Strapi 5, content-types with Draft & Publish disabled always have the publishedAt value set to a date.

此页面是 重大变更数据库 的一部分,提供有关重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的其他说明。

¥This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

重大更改描述

¥Breaking change description

在 Strapi v4 中

¥In Strapi v4

在 Strapi v4 中,禁用草稿和发布的内容类型甚至没有 publishedAt 属性。

¥In Strapi v4, a content-type with Draft & Publish disabled does not even have a publishedAt attribute.

在 Strapi 5 中

¥In Strapi 5

在 Strapi 5 中,即使内容类型的 Draft & Publish 被禁用,publishedAt 属性也始终存在。

¥In Strapi 5, the publishedAt attribute always exist even if Draft & Publish is disabled for a content-types.

迁移

¥Migration

本节重新组合了有关引入的重大更改的有用说明和程序。

¥This section regroups useful notes and procedures about the introduced breaking change.

注意

¥Notes

  • 如果启用了“草稿和发布”,publishedAt 为:

    ¥If Draft & Publish is enabled, publishedAt is:

    • null 用于文档的草稿版本

      ¥null for drafts versions of documents

    • 并设置为已发布版本的文档的发布日期。

      ¥and set to the publication date for published versions of documents.

  • 如果禁用了草稿和发布,则 publishedAt 将设置为文档的最新创建或版本日期。

    ¥If Draft & Publish is disabled, publishedAt is set to the latest creation or edition date of the document.