【问题标题】:Display apostrophe-widget in apostrophe-page在撇号页面中显示撇号小部件
【发布时间】:2019-09-17 10:24:12
【问题描述】:

我有:

  • 3d 扩展apostrophe-pieces
  • 3d-pages 扩展 apostrophe-pieces-pages
  • 3d-widgets 扩展 apostrophe-widgets

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

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

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

【问题讨论】:

    标签: apostrophe-cms


    【解决方案1】:

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

    在渲染显示特定艺术家信息的卡片时,您可以在 Open Museum 中看到这种模式。

    这是我们将在其他组件中用于渲染卡片的宏。它只是一个接受参数并返回标记的函数。 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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-09-23
      • 2019-02-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多