Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Multiple Collections

Started by Muut Archive 10 years ago · 3 replies · 589 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 2590 9 years ago
Archive · by Muut Archive, 9 years ago
2 1705 9 years ago
Archive · by Muut Archive, 9 years ago
2 4998 9 years ago
Archive · by Muut Archive, 9 years ago
1 3828 9 years ago
Archive · by Muut Archive, 9 years ago
3 1811 9 years ago