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

Multiple Collections

Started by Muut Archive 10 years ago · 3 replies · 480 views
10 years ago

Hi there,

Grave allow Multiple Collections, i wanna define my own collection. I defined it within a page header. does it also need to be defined in yaml file? i have no idea where to define the yaml file. Could you help for this, thank you

10 years ago

I have problem to access the custom collection which i defined in page header. So i have doubt that does i need to defined it in yaml file.
my code to access just like this:
{% set fruit_collection = page.collection('fruit') %}
{% for child in page.fruit_collection %}
{{ child.url }}
{% endfor %}

10 years ago

Hi,

I would say:

TWIG
{% for child in fruitcollection %}

Your fruitcollection is already a page object.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1359 9 years ago
Archive · by Muut Archive, 9 years ago
2 936 9 years ago
Archive · by Muut Archive, 9 years ago
2 4066 9 years ago
Archive · by Muut Archive, 9 years ago
1 2955 9 years ago
Archive · by Muut Archive, 9 years ago
3 1121 9 years ago