Entities

Entities

{{ entities }}

Name Type Description
is_valid Boolean Returns true if this contains at least one entity
prepended list entities that will be listed at the beginning of the items list
fetched list The primary list of entities to be included in the items list
appended list entities that will be listed at the end of the items list
appended_unique list pages that will be listed at the end of the items list, excluding any pages that are already included in either the prepended or fetched lists
items list The full list of entities in the proper order and uniqueness, including prepended, fetched, and appended entities
size Integer The total number of items in the list of items, including prepended, fetched, and appended entities
limit Integer The maximum number of entities that could have been fetched dynamically from the database
start Integer The 1-based index of the first entity that was (or would have been) dynamically fetched from the database
page Integer The 1-based index of the first "page" of entities that could have been fetched dynamically from the database - as determined by the start and limit properties
total_count Integer The total number of entities in the database that matched the provided filter parameters when fetching the list of fetched entities
total_pages Integer The total number of "pages" of results that matched the provided filter parameters when fetching the list of fetched entities - as determined by the total_count and limit properties
output String The default output that the entities will produce when it is output directly to the template - using the "output_in_list" property of each entity in the items list

Contains a collection of content, including pagination-related information.

{% entities %}

{% entities
var|set|assign
 
Optional. Specify either "var", "set" or "assign" to change which scope this entities is stored on. "var" is the default behavior.
variable_name
 
Specify a variable name in order to save this entities to a variable. If not specified, it will be output to the template instead.
output_to_template
 
If included the entities will be output directly to the template.
=
prepend:value
 
Prepend the specified entities before the fetched results. All prepended input will be returned in the same order that it is input. Value may one or more entities, a guid, or a string.
append:value
 
Append the specified entities after the fetched results. All appended input will be returned in the same order that it is input. Value may one or more entities, a guid, or a string.
exclude:value
 
Prevent the specified entities from being included in the fetched results. Has no affect on prepended and appended items. Value may one or more entities, a guid, or a string.
exclude_prepended:true
 
Specifically exclude all prepended entities from the fetched results. If "unique:true" is specified this is the default behavior, although you may also specify "exclude_prepended:false" to allow any prepended items to be fetched along with other results anyway.
exclude_appended:true
 
Specifically exclude all appended entities from the fetched results. This is false by default - even if "unique:true" is specified - so that results are returned in the proper order.
unique:true
 
If set to true, each of the resulting lists (prepended, fetched, appended, and items) will be unique, although there may be duplicates between the prepended, fetched, and appended lists. The "items" list will include objects in the order in which they appear - with prepended items first, then fetched items, then appended items.
max_size:number
 
If specified, then the "items" list will only include up to the specified number of entities. The "limit" may be automatically lowered to only fetch the maximum number of articles that will be included in "items" following prepended items. Note that this may also impact both the "page" and "total_pages" values. In order to use pagination with a list loaded using "max_size" use "start" instead of "page" and "limit".
%}

Examples

To map a collection of entities into a human-readable list of titles linking to the entities:

Copy
{% for entity in collection.items -%} {{ entity.linked_title }}{% unless forloop.first -%}{% if forloop.length == 2 %} and {% else %}, {% if forloop.last %}and {% endif %}{% endif %}{% endunless %} {%- endfor %}

Search only blog post entities by a query parameter

Copy
{% search output_to_template request.query_params.q type:blog_post %}

Encode a string for output inside other HTML markup.

Encode HTML entities in a string

Copy

A string with HTML & other characters

" | html_encode}}">...

Decode any encoded HTML entities inside a string.

Decode HTML entities in a string

Copy
{{"<p>A string with HTML & other characters</p>" | html_decode}}