| 1 |
--- |
| 2 |
title: Params |
| 3 |
description: Returns the `params` property of the given menu entry. |
| 4 |
categories: [] |
| 5 |
keywords: [] |
| 6 |
params: |
| 7 |
functions_and_methods: |
| 8 |
returnType: maps.Params |
| 9 |
signatures: [MENUENTRY.Params] |
| 10 |
--- |
| 11 |
|
| 12 |
When you define menu entries in your [project configuration][] or in [front matter][], you can include a `params` key to attach additional information to the entry. For example: |
| 13 |
|
| 14 |
{{< code-toggle file=hugo >}} |
| 15 |
[[menus.main]] |
| 16 |
name = 'About' |
| 17 |
pageRef = '/about' |
| 18 |
weight = 10 |
| 19 |
|
| 20 |
[[menus.main]] |
| 21 |
name = 'Contact' |
| 22 |
pageRef = '/contact' |
| 23 |
weight = 20 |
| 24 |
|
| 25 |
[[menus.main]] |
| 26 |
name = 'Hugo' |
| 27 |
url = 'https://gohugo.io' |
| 28 |
weight = 30 |
| 29 |
[menus.main.params] |
| 30 |
rel = 'external' |
| 31 |
{{< /code-toggle >}} |
| 32 |
|
| 33 |
With this template: |
| 34 |
|
| 35 |
```go-html-template |
| 36 |
<ul> |
| 37 |
{{ range .Site.Menus.main }} |
| 38 |
<li> |
| 39 |
<a href="{{ .URL }}" {{ with .Params.rel }}rel="{{ . }}"{{ end }}> |
| 40 |
{{ .Name }} |
| 41 |
</a> |
| 42 |
</li> |
| 43 |
{{ end }} |
| 44 |
</ul> |
| 45 |
``` |
| 46 |
|
| 47 |
Hugo renders: |
| 48 |
|
| 49 |
```html |
| 50 |
<ul> |
| 51 |
<li><a href="/about/">About</a></li> |
| 52 |
<li><a href="/contact/">Contact</a></li> |
| 53 |
<li><a href="https://gohugo.io" rel="external">Hugo</a></li> |
| 54 |
</ul> |
| 55 |
``` |
| 56 |
|
| 57 |
See the [menu templates][] section for more information. |
| 58 |
|
| 59 |
[front matter]: /content-management/menus/#define-in-front-matter |
| 60 |
[menu templates]: /templates/menu/#menu-entry-parameters |
| 61 |
[project configuration]: /content-management/menus/ |