Menu Variables
Variables
After defining the menu entries, access their properties with these variables.
- .Children
- (
menu) A collection of child menu entries, if any, under the current menu entry. - .Identifier
- (
string) Theidentifierproperty of the menu entry. If you define the menu entry automatically, the page’s.Section. - .KeyName
- (
string) Theidentifierproperty of the menu entry, else thenameproperty. - .Menu
- (
string) The identifier of the menu that contains the menu entry. - .Name
- (
string) Thenameproperty 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) Theparamsproperty of the menu entry. - .Parent
- (
string) Theparentproperty of the menu entry. - .Post
- (
template.HTML) Thepostproperty of the menu entry. - .Pre
- (
template.HTML) Thepreproperty of the menu entry. - .Title
- (
string) Thetitleproperty 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.RelPermalinkof the page associated with the menu entry. For menu entries pointing to external resources, theurlproperty of the menu entry. - .Weight
- (
int) Theweightproperty 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) Returnstrueif.Childrenis non-nil. - .IsEqual
- (
bool) Returnstrueif the compared menu entries represent the same menu entry. - .IsSameResource
- (
bool) Returnstrueif 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.