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-09 03:07:06 +0300
committerNelson/Roberto <git@nelsonroberto.com>2022-02-09 03:07:06 +0300
commitb6dfbc231aef92f37a8d1e4e646f98ef968c36bc (patch)
tree177bbf3316fb1064a40cdfdb6232945abae4878f
parente135f258557ff8e9f5002835328e1467dab2565f (diff)
Made submenu’s recursive
-rw-r--r--exampleSite/config/development/config.toml7
-rw-r--r--layouts/partials/header.html15
-rw-r--r--layouts/partials/sub-menu.html10
3 files changed, 17 insertions, 15 deletions
diff --git a/exampleSite/config/development/config.toml b/exampleSite/config/development/config.toml
index 133114f..3dd5285 100644
--- a/exampleSite/config/development/config.toml
+++ b/exampleSite/config/development/config.toml
@@ -60,4 +60,9 @@
identifier = "four"
name = "Option Four"
url = "#"
- weight = 54 \ No newline at end of file
+ weight = 54
+ [[menu.layout]]
+ parent = "three"
+ identifier = "sub-sub-menu"
+ name = "sub-sub-menu"
+ url = "#" \ No newline at end of file
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 77038d1..dfa0196 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -8,20 +8,7 @@
<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 -}}
- </li>
- {{- end -}}
- </ul>
+ {{ partial "sub-menu" . }}
{{- end -}}
</li>
{{ end }}
diff --git a/layouts/partials/sub-menu.html b/layouts/partials/sub-menu.html
new file mode 100644
index 0000000..828af9b
--- /dev/null
+++ b/layouts/partials/sub-menu.html
@@ -0,0 +1,10 @@
+<ul>
+ {{- range .Children -}}
+ <li>
+ <a href="{{ .URL }}">{{ .Name }}</a>
+ {{- if .HasChildren -}}
+ {{ partial "sub-menu" . }}
+ {{- end -}}
+ </li>
+ {{- end -}}
+</ul> \ No newline at end of file