Example
Display the number of elements of the entries stored in the Projects model.
{{ contents.projects.size }}
Syntax
{{ contents.<name> }}
name is the slug attribute of your content type.
Attributes
Name | Type | description |
---|---|---|
first | ContentEntry | First entry of the collection |
last | ContentEntry | Last entry of the collection |
empty | Boolean | True if the collection of entries is empty |
any | Boolean | True if the collection of entries is NOT empty |
size | Integer | The total number of entries |
count | Integer | Alias for size |
length | Integer | Alias for size |
public_submission_url | String | The url for the form allowing public visitors to create a new entry of the content type (ex: Contact form). The "Public submission" option for the content type has to be enabled within the back-office. |
group_by_<field name> | Array | The field name is the name of a "Select" type field of the content type. The method returns an ordered Array of Hash. Each Hash stores 2 keys, name which is the name of the option and entries which is the list of the ordered entries for the option. The Array is ordered based on the order of the options set in the back-office. |
<field name>_options | Array | The field name is the name of a "Select" type field of the content type. The method returns an ordered Array of available options. |
Read more about content types references