Skip to main content

预览内容 NewThis content is new.

¥Previewing content NewThis content is new.

使用预览功能,你可以直接从 Strapi 的管理面板预览前端应用。这有助于了解内容管理器编辑视图中的内容更新将如何影响最终结果。

¥With the Preview feature, you can preview your front end application directly from Strapi's admin panel. This is helpful to see how updates to your content in the Edit View of the Content Manager will affect the final result.

Previewing contentPreviewing content
Prerequisites
  • Strapi 管理面板用户应具有内容类型的读取权限。

    ¥The Strapi admin panel user should have read permissions for the content-type.

  • 预览功能应在 config/admin 文件的代码中进行配置(参见 开发者文档)。

    ¥The Preview feature should be configured in the code of the config/admin file (see Developer Docs).

  • 应该已经创建并运行了前端应用,以便你可以预览它。

    ¥A front-end application should already be created and running so you can preview it.

正确设置预览功能后,内容管理器编辑视图右侧将显示一个打开预览按钮。单击它将显示你的内容预览,因为它将出现在你的前端应用中,但直接在 Strapi 的管理面板中显示:

¥When the Preview feature is properly set up, an Open preview button is visible on the right in the Edit View of the Content Manager. Clicking it will display the preview of your content as it will appear in your front-end application, but directly within Strapi's the admin panel:

Previewing contentPreviewing content

从预览屏幕,你可以:

¥From the Preview screen, you can:

  • 单击关闭按钮

    ¥click the close button

Close button

返回内容管理器的编辑视图,

¥in the upper left corner to go back to the Edit View of the Content Manager,

  • 在预览草稿和已发布版本之间切换(如果内容类型启用了 起草并发布),

    ¥switch between previewing the draft and the published version (if Draft & Publish is enabled for the content-type),

  • 单击左上角的链接图标

    ¥and click the link icon

Link icon

在右上角复制预览链接。根据你当前正在查看的预览选项卡,这将复制指向草稿预览或已发布版本的链接。

¥in the upper right corner to copy the preview link. Depending on the preview tab you are currently viewing, this will either copy the link to the preview of the draft or the published version.

注意

在内容管理器的编辑视图中,如果有未保存的更改,则打开预览按钮将被禁用。保存最新更改,然后你就可以再次预览内容了。

¥In the Edit view of the Content Manager, the Open preview button will be disabled if you have unsaved changes. Save your latest changes and you should be able to preview content again.