diff options
Diffstat (limited to 'docs/content/en/templates/menu-templates.md')
-rw-r--r-- | docs/content/en/templates/menu-templates.md | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/content/en/templates/menu-templates.md b/docs/content/en/templates/menu-templates.md index e2d141f06..8dab65abf 100644 --- a/docs/content/en/templates/menu-templates.md +++ b/docs/content/en/templates/menu-templates.md @@ -7,8 +7,8 @@ menu: docs: parent: templates weight: 140 -toc: true weight: 140 +toc: true aliases: [/templates/menus/] --- @@ -28,7 +28,7 @@ The example below handles every combination. This partial template recursively "walks" a menu structure, rendering a localized, accessible nested list. -{{< code file="layouts/partials/menu.html" >}} +{{< code file=layouts/partials/menu.html copy=true >}} {{- $page := .page }} {{- $menuID := .menuID }} @@ -75,7 +75,7 @@ This partial template recursively "walks" a menu structure, rendering a localize Call the partial above, passing a menu ID and the current page in context. -{{< code file="layouts/_default/single.html" >}} +{{< code file=layouts/_default/single.html >}} {{ partial "menu.html" (dict "menuID" "main" "page" .) }} {{ partial "menu.html" (dict "menuID" "footer" "page" .) }} {{< /code >}} @@ -86,7 +86,7 @@ Regardless of how you [define menu entries], an entry associated with a page has This simplistic example renders a page parameter named `version` next to each entry's `name`. Code defensively using `with` or `if` to handle entries where (a) the entry points to an external resource, or (b) the `version` parameter is not defined. -{{< code file="layouts/_default/single.html" >}} +{{< code file=layouts/_default/single.html >}} {{- range site.Menus.main }} <a href="{{ .URL }}"> {{ .Name }} @@ -108,7 +108,7 @@ When you define menu entries [in site configuration] or [in front matter], you c This simplistic example renders a `class` attribute for each anchor element. Code defensively using `with` or `if` to handle entries where `params.class` is not defined. -{{< code file="layouts/partials/menu.html" >}} +{{< code file=layouts/partials/menu.html >}} {{- range site.Menus.main }} <a {{ with .Params.class -}} class="{{ . }}" {{ end -}} href="{{ .URL }}"> {{ .Name }} @@ -128,5 +128,5 @@ Hugo provides two methods to localize your menu entries. See [multilingual]. [localize the menu entries]: /content-management/multilingual/#menus [menu entry defined in front matter]: /content-management/menus/#example-front-matter [menu entry defined in site configuration]: /content-management/menus/#example-site-configuration -[menu variables and methods]: /variables/menus/ +[menu variables and methods]: /variables/menu-entry/ [multilingual]: /content-management/multilingual/#menus |