What an entity is, shared properties on every entity, and the entities query API.
An entity is a CMS content record: an article, blog post, page, form, folder, or other type that can have a URL. {{ entity }} is the shared shape for that record, not a separate runtime type. The value is one of the concrete types under Content. Every entity shares a common set of properties (title, guid, url, full_url, canonical_url, object_type, is_valid, and others in the tables below). Use object_type to tell which implementing type you have. Type-specific properties depend on that concrete type.
{{ entity }} is also the reserved root-scope name for the current page’s primary record. It is always set. How to output it on a page versus in a partial is covered in The Entity Object and Entity-Driven Pages under Building Sites.
{{ entities }} and {% entities %} fetch a list of entities (prepended, fetched, appended, items, size, and pagination). Working with Lists covers the shared list model. Creating and Using Collections covers fetch, filter, loop, and paginate recipes. Site search is the {% search %} method under List methods.
{{ entity }}
{{ entity }} is the shared shape for a CMS content record. It is not a separate runtime type: the value is one of the concrete entity objects (article, blog_post, form, folder, and the rest). Every entity exposes shared properties such as title, guid, url, full_url, and canonical_url. Use object_type to tell which implementing type you have. Type-specific properties depend on that concrete type.
Whether or not the user has visited this URL previously in their current session. Note that this will always be false if the user has not allowed session permission (see the Permissions and Personalization documentation). Using this property prevents the page from being fast-cached
The default output that the entity would produce if it were output directly to the template. The default output may change at any time. Template developers should avoid using this and should handle the output of different entity types themselves
Specific custom fields may be accessed using {{ entity.fieldid }} or {{entity['field-id']}}
The reserved root-scope name entity is always the current page's primary record. An entity-typed custom field uses this same shared shape: the runtime value is still a concrete entity type. See Entity under Content for shared properties and the entities query API.
ExampleCheck entity or value type with if and object_typeUse if/elsif with object_type or type checks to branch on entity or value type.
Liquid
{%- if entity.object_type == 'tag' -%}
I am a tag
{%- elsif entity.object_type == 'author' -%}
I am an author
{%- elsif entity.object_type == 'folder' -%}
I am a folder
{%- else -%}
What am I?
{%- endif -%}
If set, the maximum number of entities that will be returned in the items list and the maximum number that will be included when this object is enumerated as a list. When not set, this value will be 0
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
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
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.
If included the {% entities %} will be output directly to the template.
var, set, or assignoptionalkeyword
Optional. Specify either "var", "set" or "assign" to change which scope this {% entities %} is stored on. "var" is the default behavior.
variableoptionalvariable
argumentsrequiredcollection
Key:value pairs. May use the variable arguments syntax.
Options
prependoptionallist
May be a single , a list of entities, or the name or guid of one , to be included at the beginning of the entities list.
appendoptionallist
May be a single , a list of entities, or the name or guid of one , to be included at the end of the entities list.
excludeoptionallist
May be a single , a list of entities, or the name or guid of one that should NOT be included in the fetched results. Has no effect on prepended or appended entities.
exclude_prependedoptionalboolean
True to 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_appendedoptionalboolean
True to 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.
uniqueoptionalboolean
True to remove duplicates from each of the resulting lists (prepended, fetched, appended, and items), 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_sizeoptionalinteger
The maximum number of items to be included in the "items" list. If there are any prepended or appended items, this will automatically lower the "limit" to only fetch as many entities as needed. Note that this may also impact both the "page" and "total_pages" values in the resulting entities. In order to use pagination with a list loaded using "max_size" use "start" instead of "page" and "limit".
filteroptionalvalue
Only include entities that match the given string filter
global_type_idoptionalvalue
May include multiple types. Only include entities of the given types.
tagoptionalvalue
May include multiple tags. Only include entities with one of the given tags
authoroptionalvalue
May include multiple authors. Only include entities with one of the given authors
folderoptionalvalue
May include multiple folders. Only include entities with one of the given folders
date_created_startoptionalvalue
Only include entities with date_created greater than or equal to date_created_start. Remember that date_created will typically be the date that the entity was first published.
date_created_endoptionalvalue
Only include entities with date_created less than or equal to date_created_end. Remember that date_created will typically be the date that the entity was first published.
startoptionalinteger
Set the 1-based index of the first to fetch.
pageoptionalinteger
Used to automatically calculate the first to fetch based on both the "limit" and the 1-based "page" value. Defaults to 1, but is ignored if "start" is set.
limitoptionalinteger
The maximum number of entities to fetch. Defaults to 10. Note that if "max_size" is defined, then "limit" may be automatically lowered even if specified separately.
sort_byoptionalstring
Specify which property to sort the results by. Has no effect on prepended or appended entities. By default, results will be sorted by relevance if there is a filter string and date_created desc (newest first) if not. Options include:
relevance: only applies when there is a filter string. When sorting by relevance sort_direction is ignored.
date_created: the date each was first published. Unpublishing and republishing one resets date_created to the current date.
random: results will be returned in a random order, which prevents the page from being fast-cached. Setting cache_random:true overrides this behavior and allows the page to be fast-cached anyway.
name
title
url
browser_title
sort_directionoptionalstring
asc or desc.
cache_randomoptionalboolean
True to allow the results to be cached when sort_by is "random".