{% template_collection %}

Syntax

{% template_collection [[var|set|assign] new_variable_name] [output_to_template] [filter_name:FilterValue [...]] [start:1] [page:1] [limit:25] [sort_by:"date_created"] [sort_direction:"desc"] %}

You MUST include either a variable name to assign the collection to, "output_to_template", or both (if both output_to_template should be the later argument).

If you are assigning the collection to a variable and do not specify one of "var", "set", or "assign", then the "var" behavior will be used - which is to save the result on the current scope. If new_variable_name starts with '&', will attempt to assign the value by reference.

If you are outputting the collection to the template, it will use the default output for template_collections

Filters

For every filter in the tag, the resulting collection will only contain items that match the filter. Some filters (eg: tag) may be allowed multiple times, in which case the resulting collection will contain items that match any of the values for that filter (eg: {% ... tag:tag1 tag:tag2 tag:tag_collection tag:tag_list %}). You may also include reference variables as filters (eg: {% ... &filtername:filtervalue %}. If you include an invalid filter ({% ... invalid_filter:any %}), or if a reference variable does not evaluate to a valid filter, that filter will simply be ignored.

string template_type
Filter results to only return templates for which type exactly matches template_type.
string global_type_id
Filter results to return templates that accept global_type_id.
string|list of strings path
Only return templates with one of these paths. You may include this fulter multiple times.
datetime date_created_start
Filter results to return templates for which date_created is greater than or equal to date_created_start.
datetime date_created_end
Filter results to return templates for which date_created is less than or equal to date_created_end.

Sorting

By default the results will be sorted by date_created (the date the item was first published) desc (newest first). You may customize the order in which results are returned using any of the following options:

  • name
  • date_created (Equivalent to the date you first published this item. Unpublishing and republishing the item resets date_created to the current date)
  • random

sort_direction may either be asc or desc (default).

Developer Overview

Liquid Markup