{{ snippet }}

snippet Properties

FieldTypeDescription
object_typestring"snippet"
is_validTrue|FalseTrue if this references a snippet or false if the snippet is null
guidguid
nametext_fieldThe unique name of the snippet. This field is primarily intended for internal use by website administrators to uniquely identify snippets.
folder_guidtext_field
folderfolder
content_htmlhtml_field
tagstagsThe list of tags associated with this snippet.
valuestringSynonymn for guid
outputhtmlThe default output that the snippet produces when output directly to the template.
output_in_listhtmlThe default output that the snippet produces when output directly to the template as part of a list.

snippets Summary

Contains multiple snippets.

snippets Properties

FieldTypeDescription
object_typestring"snippets"
is_validtrue/falsetrue if this contains at least one snippet
prependedlist of snippetssnippets that will be listed at the beginning of the items list
fetchedlist of snippetsThe primary list of snippets to be included in the items list
appendedlist of snippetssnippets that will be listed at the end of the items list
appended_uniquelist of snippetssnippets that will be listed at the end of the items list, excluding any snippets that are already included in either the prepended or fetched lists
itemslist of snippetsThe full list of snippets in the proper order and uniqueness, including prepended, fetched, and appended snippets
sizenumberThe total number of items in the list of items, including prepended, fetched, and appended snippets
limitnumberThe maximum number of snippets that could have been fetched dynamically from the database
startnumberThe 1-based index of the first snippet that was (or would have been) dynamically fetched from the database
pagenumberThe 1-based index of the first "page" of snippets that could have been fetched dynamically from the database - as determined by the start and limit properties
total_countnumberThe total number of snippets in the database that matched the provided filter parameters when fetching the list of fetched snippets
total_pagesnumberThe total number of "pages" of results that matched the provided filter parameters when fetching the list of fetched snippets - as determined by the total_count and limit properties
outputhtmlThe default output that the snippets will produce when it is output directly to the template - using the "output_in_list" property of each snippet in the items list

Methods

{% snippet %}

Fetch a single snippet.

{% snippet
[var|set|assign] new_variable_name
Specify a variable name in order to save the snippet to a variable. If not specified the snippet will be output to the template instead. The variable will be saved using the "var" behavior unless "set" or "assign" are specified.
output_to_template
If included, the snippet will be output directly to the template.
=
snippet|guid|string
%}

{% snippets %}

Fetch a list of snippets.

{% snippets
[var|set|assign] new_variable_name
Specify a variable name in order to save the results to a variable. If not specified the results will be output to the template instead. The variable will be saved using the "var" behavior unless "set" or "assign" are specified.
output_to_template
If included, the results will be output directly to the template.
=
prepend:snippet|snippets|guid|string
Prepend the specified snippets before the fetched results. All prepended input will be returned in the same order that it is input.
append:snippet|snippets|guid|string
Append the specified snippets after the fetched results. All appended input will be returned in the same order that it is input.
exclude:snippet|snippets|guid|string
Prevent the specified snippets from being included in the fetched results. Has no affect on prepended and appended snippets
exclude_prepended:true
Specifically exclude all prepended snippets 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 snippets 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:25
If specified, then the "items" list will only include up to the specified number of snippets. The "limit" may be automatically lowered to only fetch the maximum number of snippets 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".
tag:tag|tags|guid|string
Only return snippets with one of these tags
folder:folder|folders|guid|string
Only return snippets with one of these folders
date_created_start:datetime
Filter results to return snippets for which date_created is greater than or equal to date_created_start.
date_created_end:datetime
Filter results to return snippets for which date_created is less than or equal to date_created_end.
start:1
Set the 1-based index of the first snippet to fetch.
page:1
Automatically calculate the first snippet to fetch based on both of the "limit" and the 1-based "page" value. Ignored if "start" is set.
limit:25
Defines the maximum number of snippets to be fetched. If not included, this will default to 10. Note that if "max_size" is specified then "limit" may be automatically lowered even if specified.
sort_by:"date_created"
Specify which field to sort the fetched results by. Has no affect on prepended or appended snippets.
By default results will be sorted by date_created (the date the item was first published) desc (newest first).
Other Options include:
  • 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 (Using random sorting prevents fast caching of the page).
sort_direction:"desc"
Specify whether the fetched results should be sorted in asc (ascending) or desc (descending) order.
%}

If you do not include any filters or inputs other than prepended items, appended items, or max_size, then no additional items will be fetched. If you wish to fetch all items you must include at least one additional input (ie: "start:1")