Menu

Menu

{{ menu }}

Name Type Description
object_type String Will always be datastore_item
is_valid Boolean True if this references a published menu
guid String The unique identifier for this menu
value String Contains the same value as guid
name text The name of this menu, primarily used for identification and organization
items menu_items A list containing all of the top-level menu_items in the current menu
field_id String The identifier for this field
label String The label for this field
output String The default output that the menu produces when 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 menus themselves

{{ menus }}

Contains multiple menus.

Name Type Description
output String The default output that the menus will produce when it is output directly to the template - using the "output_in_list" property of each menu in the items list

{% menu %}

{% menu
var|set|assign
 
Optional. Specify either "var", "set" or "assign" to change which scope this menu is stored on. "var" is the default behavior.
variable_name
 
Specify a variable name in order to save this menu to a variable. If not specified, it will be output to the template instead.
output_to_template
 
If included the menu will be output directly to the template.
=
%}

Examples

Fetching Menu Items

Copy
{% menu var mainMenu = "Main" %} {% for item in mainMenu.items %} {{item.title}} {% endfor %}

{% menus %}

{% menus
var|set|assign
 
Optional. Specify either "var", "set" or "assign" to change which scope this menus is stored on. "var" is the default behavior.
variable_name
 
Specify a variable name in order to save this menus to a variable. If not specified, it will be output to the template instead.
output_to_template
 
If included the menus will be output directly to the template.
=
prepend:value
 
Prepend the specified menus before the fetched results. All prepended input will be returned in the same order that it is input. Value may one or more menus, a guid, or a string.
append:value
 
Append the specified menus after the fetched results. All appended input will be returned in the same order that it is input. Value may one or more menus, a guid, or a string.
exclude:value
 
Prevent the specified menus from being included in the fetched results. Has no affect on prepended and appended items. Value may one or more menus, a guid, or a string.
exclude_prepended:true
 
Specifically exclude all prepended menus 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 menus 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 menus. 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".
%}