collection
A collection of records for a certain Content Type. This object is returned when a content type for posts' plural name is called on site, e.g. site.pages
. A collection is also returned when a content type’s plural name is called on the site.content_objects container object for abstract content.
collection
When no attribute is called on the collection, it outputs all records inside as an array. E.g. calling site.pages
just outputs all posts with the post_type page
.
collection.id_is_{:value}
Returns a single record by id. E.g. site.pages.id_is_1234
returns the post with post_type page
and id 1234
and site.content_objects.categories.id_is_1234
does the same for the abstract content type categories
.
collection.{:content_field}_is_{:value}
Returns a single record by the value of a content_field. E.g. site.pages.custom_field_is_test_value
returns the post with post_type page
and with the value of it’s content_field custom_field
as test_value
.
collection['id_in_[{:value}, {:value}, …]']
Returns multiple records by array of id's. E.g. site.pages['id_in_[1234,9876]']
returns both the posts with post_type page
and id 1234
and 9876
. Also, site.content_objects.categories['id_in_[1234,9876]']
does the same for the abstract content type categories
.
collection['{:content_field}_in_[{:value}, {:value}, …]']
Returns multiple records by the values of a content_field. E.g. site.pages['custom_field_in_[test_value1,test_value2]']
returns all posts with post_type page
and with the value of it’s content_field custom_field
as test_value1
or test_value2
. This also works the other way around: if a single value is passed all records containing that value will be returned. E.g. site.pages['custom_field_in_[test_value1]']
will return all posts where the value for custom_field
is test_value1
{:content_field}_in_{:collection}_as_{:value}
Returns multiple records by the values of a content_field. E.g.
test_value1.referenced_in_pages_as_custom_field
returns all posts with post_type page
and with the value of it’s content_field custom_field
as test_value1
.