Read the fields of the container of a collection

36 views Asked by At

I have a container for example: students.{title, description, children=student} and student={title, ...}

# students.ini
[model]
name = Students

[fields.title]
label = Title
type = string

[fields.description]
label = Description
type = markdown

[children]
model = student
# student.ini
[model]
name = Student

[fields.title]
label = Title
type = string

I would like to get the title/description of the studentS container.

{% set root = site.get('/students') %}
{{ root.description }}

But with get or query, I get the list and not the container...

Any idea?

Thank you

1

There are 1 answers

0
lupdidup On

Sure, you have to access the record attribute first:

{{ site.get('/students').record.description }}

... and you can always access the .parent attribute of a child.