Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Macros with page collections

Started by Muut Archive 10 years ago · 1 replies · 737 views
10 years ago

Hello! I have this peace of code:

TWIG
{% for page in page.find('/xyz').collection('content_package-nr_1') %}
     {{ page.content }}
{% endfor %} 

The only thing what changes here is .collection('nameX'). I have a page with X of collections in it. My question is, how to this with macros? In the end the result could be somehting like:

TWIG
{% for page  in page.find('/xyz').collection() %}
   {{ _self.loop(page) }}
{% endfor %} 

Hope i made my question clear enough )

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1368 9 years ago
Archive · by Muut Archive, 9 years ago
2 940 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2960 9 years ago
Archive · by Muut Archive, 9 years ago
3 1125 9 years ago