Skip to main content

管理内容类型

¥Managing content-types

✏️ development-only

仅当你的 Strapi 应用位于开发环境中时,才能访问内容类型生成器来创建和更新内容类型,否则它将在其他环境中处于只读模式。

¥The Content-type Builder is only accessible to create and update content-types when your Strapi application is in a development environment, else it will be in a read-only mode in other environments.

内容类型生成器允许管理任何现有的内容类型或组件,即使它已经在内容管理器中使用。一次只能管理一个。

¥The Content-type Builder allows to manage any existing content-type or component, even if it is already being used in the Content Manager. They can only be managed one at a time.

要管理内容类型或组件,请在“集合类型”、“单一类型”或“组件”类别中单击其名称。

¥To manage a content-type or a component, click on its name in the Collection types, Single types or Components category.

编辑内容类型

¥Editing content-types

管理内容类型或组件可以包括编辑常规设置和字段,还可以删除整个内容类型或组件。对于任何选定的组件内容类型,内容类型生成器界面的右侧会显示所有可用的编辑选项。

¥Managing a content-type or component can include editing the general settings and the fields, but also deleting the whole content-type or component. For any chosen content-type of component, the right side of the Content-type Builder interface displays all available editing options.

Content-type Builder's edition interfaceContent-type Builder's edition interface
  • 在内容类型或组件的名称和可选描述旁边,

    ¥Next to the name and optional description of the content-type or component, an

Edit icon

编辑按钮 (1) 允许访问内容类型或组件的 常规设置

¥Edit button (1) allows to access the general settings of the content-type or component.

  • 在右上角:

    ¥In the top right corner:

    • 添加新字段和保存按钮 (2) 允许分别向内容类型或组件添加另一个字段(参见 为内容类型配置字段),或保存任何正在进行的修改。

      ¥the Add new field and Save buttons (2) allow to respectively add another field to the content-type or component (see Configuring fields for content-types), or save any ongoing modification.

    • 配置视图按钮允许访问视图配置界面(参见 配置编辑视图

      ¥the Configure the view button allows to access the view configuration interface (see Configuring the edit view)

  • 在之前的编辑选项下方,表 (3) 列出了为内容类型或组件创建和配置的所有字段。从字段表中,可以:

    ¥Below the previous editing options, a table (3) lists all the fields created and configured for the content-type or component. From the fields table, it is possible to:

    • 单击编辑按钮

      ¥Click on the edit button

Edit icon

编辑字段

¥to edit a field

  • 单击删除按钮

    ¥Click on the delete button

Delete icon

删除字段

¥to delete a field

提醒

编辑字段允许对其进行重命名。但是,请记住,对于数据库,重命名字段意味着创建一个全新的字段并删除前一个字段。尽管数据库中没有删除任何内容,但与以前的字段名称关联的数据将无法再从应用的管理面板访问。

¥Editing a field allows renaming it. However, keep in mind that regarding the database, renaming a field means creating a whole new field and deleting the former one. Although nothing is deleted from the database, the data that was associated with the former field name will not be accessible from the admin panel of your application anymore.

编辑内容类型或组件设置

¥Editing content-type or component settings

内容类型或组件的设置可以通过内容类型生成器进行编辑。有两个选项卡可用:基本设置和高级设置。

¥The settings of a content-type or component can be edited through the Content-type Builder. There are two tabs available: Basic Settings and Advanced Settings.

基本设置

¥Basic settings

基本设置选项卡允许编辑内容类型或组件的以下属性:

¥The Basic Settings tab allows to edit the following properties of the content-type or component:

Content-type Builder's basic settingsContent-type Builder's basic settings
  • 显示名称:将在管理面板中显示的内容类型或组件的名称。

    ¥Display name: Name of the content-type or component as it will be displayed in the admin panel.

  • API ID(单数):将在 API 中使用的内容类型或组件的名称。它是根据显示名称自动生成的,但可以编辑。

    ¥API ID (singular): Name of the content-type or component as it will be used in the API. It is automatically generated from the display name, but can be edited.

  • API ID(复数):将在 API 中使用的内容类型或组件的复数名称。它是根据显示名称自动生成的,但可以编辑。

    ¥API ID (plural): Plural name of the content-type or component as it will be used in the API. It is automatically generated from the display name, but can be edited.

  • 类型:内容类型或组件的类型。它可以是 Collection 类型,也可以是 Single 类型。

    ¥Type: Type of the content-type or component. It can be either a Collection type or a Single type.

高级设置

¥Advanced settings

“高级设置”选项卡允许编辑内容类型或组件的以下属性:

¥The Advanced Settings tab allows to edit the following properties of the content-type or component:

Content-type Builder's advanced settingsContent-type Builder's advanced settings
  • 起草并发布:为内容类型或组件启用草稿和发布功能。默认情况下它是禁用的。

    ¥Draft & Publish: Enable the draft and publish feature for the content-type or component. It is disabled by default.

  • 国际化:启用内容类型或组件的国际化功能。默认情况下它是禁用的。

    ¥Internationalization: Enable the internationalization feature for the content-type or component. It is disabled by default.

  • 审查工作流程:为内容类型启用 审查工作流程 Enterprise 功能。默认情况下它是禁用的。

    ¥Review workflows: Enable the Review Workflows Enterprise feature for the content-type. It is disabled by default.

删除内容类型

¥Deleting content-types

内容类型和组件可以通过内容类型生成器删除。删除内容类型会自动从内容管理器中删除基于该内容类型的所有条目。删除组件也是如此,该组件会从使用它的每个内容类型或条目中自动删除。

¥Content types and components can be deleted through the Content-type Builder. Deleting a content-type automatically deletes all entries from the Content Manager that were based on that content-type. The same goes for the deletion of a component, which is automatically deleted from every content-type or entry where it was used.

要删除内容类型或组件:

¥To delete a content-type or component:

  1. 在内容类型生成器子导航中,单击要删除的内容类型或组件的名称。

    ¥In the Content-type Builder sub navigation, click on the name of the content-type or component to delete.

  2. 在所选内容类型或组件的编辑界面中,单击

    ¥In the edition interface of the chosen content-type or component, click on the

Edit icon

内容类型或组件名称右侧的编辑按钮。3.4.

¥Edit button on the right side of the content-type's or component's name. 3. In the edition window, click on the Delete button. 4. In the confirmation window, confirm the deletion.

提醒

删除内容类型只会删除内容类型生成器中创建和可用的内容,并在一定程度上从 Strapi 应用的管理面板中删除。然而,基于该内容类型创建的所有数据都保留在数据库中。欲了解更多信息,请参阅相关的 GitHub 问题

¥Deleting a content-type only deletes what was created and available from the Content-type Builder, and by extent from the admin panel of your Strapi application. All the data that was created based on that content-type is however kept in the database. For more information, please refer to the related GitHub issue.