Search code examples
grav

How to get {{ pages }} object in a modular page


Any thoughts on how to get the pages object in a modular page?

{{ dump(pages) }} returns null, but if I put the same statement in a regular page it works fine.

I have a page field that only gives me the URL of the selected pages and I need to get their title, ideally by just doing pages.find(link).title but "pages" is null for some reason.


Solution

  • For using page find, you have to use the singular page, not pages. example: {{ page.find('/contact').title }}

    That said, you being not able to access the pages object from a modular page is probably a bug that should be reported as I see no reason why this would not work.