diff options
author | Fabien CASTERS <fabien@vaga.io> | 2020-10-08 13:19:14 +0300 |
---|---|---|
committer | Fabien <vaga@users.noreply.github.com> | 2020-10-08 13:24:48 +0300 |
commit | 982e21856dac446de160ebebff02c419feac86a7 (patch) | |
tree | cd5ef51d8ecbe691ea8ce313cdf80c1ca4a1ac43 | |
parent | 143e072fa91595d85dda9b16859edaa56d35528e (diff) |
Add option `menu_item_separator`
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | exampleSite/config.toml | 5 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 8 |
3 files changed, 11 insertions, 3 deletions
@@ -31,6 +31,7 @@ In your `config.toml` file, define the following variables in `params`: - `author`: Name of the author - `description`: Short description of the author - `avatar`: Path of file containing the author avatar image +- `menu_item_separator`: Separator between each menu item. HTML allowed (default: " - ") To add a menu item, add the following lines in `menu`: diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 1708f19..c551e8d 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -6,6 +6,10 @@ paginate = 5 [menu] [[menu.main]] + identifier = "home" + name = "Home" + url = "/" + [[menu.main]] identifier = "tags" name = "Tags" url = "/tags/" @@ -13,6 +17,7 @@ paginate = 5 [params] author = "John Doe" description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc vehicula turpis sit amet elit pretium." + menu_item_separator = " - " [[params.social]] name = "github" url = "https://github.com/gohugoio" diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 923d10e..35db6f1 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -21,9 +21,11 @@ <h1>{{ .Site.Title }}</h1> {{- with .Site.Menus.main }} <nav class="app-header-menu"> - - - {{- range . }} - <a href="{{ .URL }}">{{ .Name }}</a> - + {{- range $key, $item := . }} + {{- if ne $key 0 }} + {{ $.Site.Params.menu_item_separator | default " - " | safeHTML }} + {{ end }} + <a class="app-header-menu-item" href="{{ $item.URL }}">{{ $item.Name }}</a> {{- end }} </nav> {{- end }} |