【问题标题】:How i can access to children pages widgets of a page on Apostrophe CMS我如何访问 Apostrophe CMS 上页面的子页面小部件
【发布时间】:2018-06-11 06:33:07
【问题描述】:

我的一个项目页面上有以下代码:

{% if data.page %}
    <ul>
    {%for child in data.page._children %}
    <li><a href="{{ child._url}}"></a>{{child.title}}
    <p>{{ apos.area(child, 'excerpt', 
            { widgets: 
                { 'apostrophe-rich-text': 
                    {
                    toolbar: [ 
                       'Styles', 
                       'Bold', 
                       'Italic', 
                       'Link',
                       'Unlink'] 
                    }
                }
            })
        }}
    </p>
    </li>
  {% endfor %}
  </ul>
{% endif %}

其中“摘录”是当前页面的所有子页面上的一个区域,但是当页面显示时,我只看到一个空框: empty box

我在文档中看到了类似 how to: children and joins 的内容,但我不确定将示例代码放在哪里才能工作(可能文档不够清楚)。

请给我一些建议,谢谢。

【问题讨论】:

  • 您在服务器或浏览器控制台上没有收到任何错误?我在上面使用了您的确切代码,并且事情按预期工作。你确定你已经登录了吗?
  • 是的,我已登录,但我没有看到任何小部件按钮...也许问题是由我安装撇号引起的。无论如何,我实现了一个基于撇号博客模块的解决方案。

标签: node.js nunjucks apostrophe-cms


【解决方案1】:

There is now an official HOWTO answering this question on the Apostrophe documentation site. 简而言之,答案是您必须配置apostrophe-pages 以加载更多有关相关页面的基本信息。当然,存在性能折衷,但您可以通过指示 Apostrophe 仅为您用于此目的的单例名称或区域名称加载图像来限制这一点。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-07-11
    • 1970-01-01
    • 2018-06-12
    • 1970-01-01
    • 2020-07-09
    • 2018-06-04
    • 1970-01-01
    相关资源
    最近更新 更多