在撇号页面中显示撇号小部件

Display apostrophe-widget in apostrophe-page

我有:

我的 3d-widgets/views/widget.html 可以正确显示 3D 对象。

在使用 3d-pages/views/show.html 显示 3d 对象时如何使用该小部件?

我不想重新发明轮子,把3d-widgets/views/widget.html复制到3d-pages/views/show.html

您希望 show.htmlwidget.html 都使用 nunjucks 宏,这样您就有了一个独立的标记,唯一的工作就是渲染 3d 对象。

在渲染显示特定艺术家信息的卡片时,您可以在开放博物馆中看到该模式。

这是我们将在其他组件中用来渲染卡片的宏。它只是一个接受参数和 returns 标记的函数。 https://github.com/apostrophecms/apostrophe-open-museum/blob/master/views/macros/artist-cards.html

这是艺术家索引页面,我们在其中迭代 pieces 并使用宏渲染卡片 https://github.com/apostrophecms/apostrophe-open-museum/blob/f1756c566e46f85f6370a3d1a2c934b342dc7478/lib/modules/artists-pages/views/index.html

然后搜索结果页面也让我们使用宏来显示作为搜索一部分返回的艺术家的信息 https://github.com/apostrophecms/apostrophe-open-museum/blob/b2b20a4d7da355c8f448a1442dd17b4a76c2f285/lib/modules/apostrophe-search/views/index.html#L5