Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Multiple Collections

Started by Muut Archive 10 years ago · 3 replies · 666 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 Muut Archive, 10 years ago
1 674 1 week ago
Archive · by Deleted User, 9 years ago
0 3043 9 years ago
Archive · by Muut Archive, 9 years ago
2 1983 9 years ago
Archive · by Muut Archive, 9 years ago
2 5337 9 years ago
Archive · by Muut Archive, 9 years ago
1 4134 9 years ago