Menu item
Represents single menu item object in site structure. You can build site structure by using available menuitem objects.
List of available attributes
These properties give access to extra features on this object.
- all_children
- all_children_with_data
- blog?
- children_with_hidden
- children_with_hidden_with_data
- children?
- children
- children_with_data
- content_type
- current?
- data
- hidden_children
- hidden_children_with_data
- hidden?
- image?
- image
- layout_title
- link?
- og_image?
- og_image
- page_id
- page
- path
- private?
- selected_with_children?
- selected?
- title
- to_json
- translated?
- url
- visible_children
- visible_children_with_data
all_children
Returns list of item objects which are representing all children (whether translated or untranslated) of current item.
all_children_with_data
As all_children
, but includes the pages' data
.
blog?
Returns true if the page associated with item is of the blog type.
children
Returns a list of menu item objects which represent visible and translated children of the page of this menu item.
children_with_data
As children
, but includes the pages' data
.
children?
Returns true if menu item has visible and translated children objects.
children_with_hidden
Same as children
but includes child menuitems that are hidden.
children_with_hidden
Same as children_with_hidden
but includes the pages'data
.
content_type
Returns content type of the page associated with this item.
current?
data
hidden?
Returns true if page is hidden from menu.
hidden_children
Returns all hidden child menu items. Useful when creating hidden menuitems button with {% menubtn %}
tag like this:
{% menubtn item.hidden_children %}
hidden_children_with_data
Same as hidden_children
but includes the pages' data
.
image
If menu item is obtained with the _with_data
suffix returns an image object that is attached to page from page settings.
image?
If menu item is obtained with the _with_data
suffix it returns true
or false
depending whether image is attached to page.
og_image
If menu item is obtained with the _with_data
suffix it returns image object that is attached to page from page settings. Alias for image.
og_image?
If menu item is obtained with the _with_data
suffix it returns true
or false
depending whether image is attached to page. Alias for image?.
layout_title
Returns the name of the page's layout.
link?
Returns true if page is an external link.
path
Returns relative path for given page item.
page_id
Returns id for given page item.
page
Returns related page object for given menu item.
private?
Returns true if page is password protected.
selected?
Returns true if page or one of its descendants is currently active.
selected_with_children?
Returns true if this menu item is currently selected AND also has children.
title
Returns the title of the page of this menu item. The value returned is that of page.menu_title, falling back to page.title if page.menu_tile is not set for the page.
translated?
Returns true if item is translated.
url
Returns the URL of the page.
visible_children
Returns all children of current menu item that are visible.
visible_children_with_data
Same as visible_children
but includes the pages' data
.
to_json
Serializes the menu item into a JSON string.