Menu variables
Variables
After defining menu entries, access their properties in menu templates with these variables.
- .Children
- (
menu
) A collection of child menu entries, if any, under the current menu entry. - .Identifier
- (
string
) Theidentifier
property of the menu entry. If you define the menu entry automatically, the page’s.Section
. - .KeyName
- (
string
) Theidentifier
property of the menu entry, else thename
property. - .Menu
- (
string
) The identifier of the menu that contains the menu entry. - .Name
- (
string
) Thename
property of the menu entry.
- If you define the menu entry automatically, the page’s
.LinkTitle
, else the page’s.Title
. - If you define the menu in front matter or in site configuration, falls back to the page’s
.LinkTitle
, then to the page’s.Title
.
- .Page
- (
page
) A reference to the page associated with the menu entry.
- .Params
- (
map
) Theparams
property of the menu entry. - .Parent
- (
string
) Theparent
property of the menu entry. - .Post
- (
template.HTML
) Thepost
property of the menu entry. - .Pre
- (
template.HTML
) Thepre
property of the menu entry. - .Title
- (
string
) Thetitle
property of the menu entry.
- If you define the menu entry automatically, the page’s
.LinkTitle
, else the page’s.Title
. - If you define the menu in front matter or in site configuration, falls back to the page’s
.LinkTitle
, then to the page’s.Title
.
- .URL
- (
string
) The.RelPermalink
of the page associated with the menu entry. For menu entries pointing to external resources, theurl
property of the menu entry. - .Weight
- (
int
) Theweight
property of the menu entry.
- If you define the menu entry automatically, the page’s
.Weight
. - If you define the menu in front matter or in site configuration, falls back to the page’s
.Weight
.
Methods
- .HasChildren
- (
bool
) Returnstrue
if.Children
is non-nil. - .IsEqual
- (
bool
) Returnstrue
if the compared menu entries represent the same menu entry. - .IsSameResource
- (
bool
) Returnstrue
if the compared menu entries point to the same resource. - .Page.HasMenuCurrent
- (
bool
) Use this method to determine ancestors of the active menu entry. See details. - .Page.IsMenuCurrent
- (
bool
) Use this method to determine the active menu entry. See details.