Diazo - 错误显示消息(当您从页面获取内容时)

Diazo - on error show message (when you get the content from a page)

我们可以跳过重氮错误并通过在页面中将其替换为友好消息来防止页面崩溃吗?类似于:您想要在此页面中显示的内容未创建或发布。请检查此部分 /source/homepage-content-sample-section.html.

<!-- Images slider section -->
<replace css:theme="[data-diazo='my-images-slider']"
         href="homepage-content/homepage-images-slider" method="document"
         css:content-children="#content-core" />
<drop css:content="#content-core [data-diazo='my-images-slider']" />

我在 Plone 中为主页中的每个部分创建了一个页面,其中包含 html 易于编辑的代码。问题是,如果某个页面丢失或私有,主页就会损坏。

在重氮规则中用 href 调用 user-managed 内容就像玩俄罗斯轮盘赌一样。如果页面不存在,则无法防止页面崩溃。

最好的方法是调用 developer-defined URL 负责检索内容(如果内容存在),如果内容不存在,return 什么都不做。

Rapido 是一种非常简单的方法(您创建一个可以像这样调用的 Rapido 块:href="@@rapido/myapp/blocks/get-content-for-my-homepage",这个 URL 将始终有效,您的页面永远不会崩溃用户已完成内容)。