2017-08-10 11:18:22 -04:00
|
|
|
---
|
|
|
|
title: Menu Variables
|
|
|
|
linktitle: Menu Variables
|
|
|
|
description: A menu entry in a menu template has specific variables and functions to make menu management easier.
|
|
|
|
date: 2017-03-12
|
|
|
|
publishdate: 2017-03-12
|
|
|
|
lastmod: 2017-03-12
|
|
|
|
categories: [variables and params]
|
2017-09-21 13:03:00 -04:00
|
|
|
keywords: [menus]
|
2017-08-10 11:18:22 -04:00
|
|
|
draft: false
|
|
|
|
menu:
|
|
|
|
docs:
|
2018-01-31 05:07:47 -05:00
|
|
|
title: "variables defined by a menu entry"
|
2017-08-10 11:18:22 -04:00
|
|
|
parent: "variables"
|
|
|
|
weight: 50
|
|
|
|
weight: 50
|
|
|
|
sections_weight: 50
|
|
|
|
aliases: [/variables/menu/]
|
|
|
|
toc: false
|
|
|
|
---
|
|
|
|
|
|
|
|
The [menu template][] has the following properties:
|
|
|
|
|
2017-12-30 03:15:31 -05:00
|
|
|
.URL
|
2017-08-10 11:18:22 -04:00
|
|
|
: string
|
|
|
|
|
2017-12-30 03:15:31 -05:00
|
|
|
.Name
|
2017-08-10 11:18:22 -04:00
|
|
|
: string
|
|
|
|
|
2018-01-31 05:07:47 -05:00
|
|
|
.Title
|
|
|
|
: string
|
|
|
|
|
|
|
|
This is a link title, meant to be used in `title`-Attributes of the menu's `<a>`-tags.
|
|
|
|
By default it returns `.Page.LinkTitle`, as long as the menu entry was created
|
|
|
|
through the page's front matter and not through the site config.
|
|
|
|
Setting it explicitly in the site config or the page's front matter overrides this behaviour.
|
|
|
|
|
|
|
|
.Page
|
|
|
|
: [Page Object](/variables/page/)
|
|
|
|
|
|
|
|
The `.Page` variable holds a reference to the page.
|
|
|
|
It's only set when the menu entry is created from the page's front matter,
|
|
|
|
not when it's created from the site config.
|
|
|
|
|
|
|
|
|
2017-12-30 03:15:31 -05:00
|
|
|
.Menu
|
2017-08-10 11:18:22 -04:00
|
|
|
: string
|
|
|
|
|
2017-12-30 03:15:31 -05:00
|
|
|
.Identifier
|
2017-08-10 11:18:22 -04:00
|
|
|
: string
|
|
|
|
|
2017-12-30 03:15:31 -05:00
|
|
|
.Pre
|
2017-08-10 11:18:22 -04:00
|
|
|
: template.HTML
|
|
|
|
|
2017-12-30 03:15:31 -05:00
|
|
|
.Post
|
2017-08-10 11:18:22 -04:00
|
|
|
: template.HTML
|
|
|
|
|
2017-12-30 03:15:31 -05:00
|
|
|
.Weight
|
2017-08-10 11:18:22 -04:00
|
|
|
: int
|
|
|
|
|
2017-12-30 03:15:31 -05:00
|
|
|
.Parent
|
2017-08-10 11:18:22 -04:00
|
|
|
: string
|
|
|
|
|
2017-12-30 03:15:31 -05:00
|
|
|
.Children
|
2017-08-10 11:18:22 -04:00
|
|
|
: Menu
|
|
|
|
|
2018-01-31 05:07:47 -05:00
|
|
|
[menu template]: /templates/menu-templates/
|