In the home page (which is a modular page) I want to render a section (which would be a submodule in Grav lingo, I guess) that contains the last 4 diaries entry.
Diaries are modular pages themselves with the following structure:
06.diaries
diary1
_content
diary.md
_bar
bar.md
modular.md
diary2
...
In order to achieve this I wrote a collection page under the 01.home/_diaries_preview folder, which should be responsible to fetch the last 4 diaries and render them in the homepage.
My page collection definition looks as follow (only the relevant part)
content:
items:
'page@.modular': '/diaries'
limit: 4
In the diaries_preview section of the homepage I’m only interested in rendering a summary of the text contained in the 06.diaries/diary1/_content/diary.md for example.
The page collection twig is something as follows (simplified for clarity):
{% for row in page.collection %}
{% for item in row %}
<p>{{ item.summary() }}</p>
but the summary part is always empty. I tried to debug but it seems like the modular pages don’t get correctly processed and passed to the twig, I’m wondering if I’m doing something obviously wrong, I’m pretty new with Grav.
Thank you