Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dewittn/hugo-html5up-alpha.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNelson/Roberto <git@nelsonroberto.com>2022-02-04 23:24:05 +0300
committerNelson/Roberto <git@nelsonroberto.com>2022-02-04 23:24:05 +0300
commit16424be492a6096b2b995ddeeaf180da0b8f518f (patch)
tree4753b03f25b881fb8e6612d5393a890cf53539b8
parentaf5d06429fe7ecc705a3758f95e2e41437f5381d (diff)
Working menu system with multiple submenus
-rw-r--r--exampleSite/config/development/config.toml35
-rw-r--r--layouts/partials/header.html38
2 files changed, 42 insertions, 31 deletions
diff --git a/exampleSite/config/development/config.toml b/exampleSite/config/development/config.toml
index 9a9b570..133114f 100644
--- a/exampleSite/config/development/config.toml
+++ b/exampleSite/config/development/config.toml
@@ -5,52 +5,59 @@
### For Pages the .RelPermalink must match the menu .URL
### For sections the name/directory must match the menu .Identifier
[menu]
- [[menu.main]]
- identifier = "generic"
- name = "Generic"
- url = "/generic/"
+ [[menu.home]]
+ identifier = "home"
+ name = "Home"
+ url = "/"
weight = 10
- [[menu.main]]
+ [[menu.layout]]
+ identifier = "layout"
+ name = "Layout"
+ url = "#"
+ [[menu.layout]]
+ parent = "layout"
identifier = "contact"
name = "Contact"
url = "/contact/"
- weight = 20
- [[menu.main]]
+ [[menu.layout]]
+ parent = "layout"
identifier = "elements"
name = "Elements"
url = "/elements/"
weight = 30
- [[menu.main]]
+ [[menu.layout]]
+ parent = "layout"
identifier = "blog"
name = "Blog"
url = "/blog/"
weight = 40
- [[menu.main]]
+ [[menu.layout]]
+ parent = "layout"
identifier = "submenu"
name = "Submenu"
url = "#"
weight = 50
- [[menu.main]]
+ [[menu.layout]]
parent = "submenu"
identifier = "one"
name = "Option One"
url = "#"
weight = 51
- [[menu.main]]
+ [[menu.layout]]
parent = "submenu"
identifier = "two"
name = "Option Two"
url = "#"
weight = 52
- [[menu.main]]
+ [[menu.layout]]
parent = "submenu"
identifier = "three"
name = "Option Three"
url = "#"
weight = 53
- [[menu.main]]
+ [[menu.layout]]
parent = "submenu"
identifier = "four"
name = "Option Four"
url = "#"
- weight = 54
+ weight = 54 \ No newline at end of file
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index e78bc14..77038d1 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -3,26 +3,30 @@
<h1>{{ with .Site.Data.globalheader.title }}{{ . | markdownify }}{{else}}{{ .Site.Title }}{{end}}</h1>
<nav id="nav">
<ul>
- <li><a href="{{ .Site.BaseURL }}">Home</a></li>
- <li>
- <a href="#" class="icon solid fa-angle-down">Layouts</a>
- <ul>
- {{- range .Site.Menus.main -}}
- {{- if .HasChildren -}}
- <li>
- <a href="{{ .URL }}">{{ .Name }}</a>
- <ul>
- {{- range .Children -}}
- <li><a href="{{ .URL }}">{{ .Name }}</a></li>
+ {{- range .Site.Menus -}}
+ {{ range . }}
+ <li>
+ <a href="{{ .URL }}" {{- if .HasChildren -}}class="icon solid fa-angle-down"{{- end -}} >{{ .Name }}</a>
+ {{- if .HasChildren -}}
+ <ul>
+ {{- range .Children -}}
+ <li>
+ <a href="{{ .URL }}">{{ .Name }}</a>
+ {{- if .HasChildren -}}
+ <ul>
+ {{- range .Children -}}
+ <li><a href="{{ .URL }}">{{ .Name }}</a></li>
+ {{- end -}}
+ </ul>
{{- end -}}
- </ul>
- </li>
- {{- else -}}
- <li><a href="{{ .URL }}">{{ .Name }}</a></li>
+ </li>
{{- end -}}
+ </ul>
{{- end -}}
- </ul>
- </li>
+ </li>
+ {{ end }}
+ {{- end -}}
+
{{ $button := .Site.Data.globalheader.button }}
{{ if $button.enable }}
<li><a href="{{ $button.link }}" class="button">{{ $button.title }}</a></li>