Search code examples
node.jsnunjucksapostrophe-cms

How i can access to children pages widgets of a page on Apostrophe CMS


I have the following code on one of my project page:

{% 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 %}

Where 'excerpt' is a area on all children pages of the current page, but when the page is displayed I only see a empty box: empty box

I see on the docs something similiar how to: children and joins, but I´m not sure where to put the example code for this to work(maybe the docs are not enough clear).

Please can give me some advice, thank you.


Solution

  • There is now an official HOWTO answering this question on the Apostrophe documentation site. Briefly, the answer is that you must configure apostrophe-pages to load more than just basic information about related pages. There is a performance tradeoff, of course, but you can limit this by instructing Apostrophe to load images only for the singleton or area name that you are using for this purpose.