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 <dewittn@gmail.com>2020-05-10 14:49:52 +0300
committerNelson/Roberto <dewittn@gmail.com>2020-05-10 14:49:52 +0300
commit9d7e21f036a510356c89e6beb77fee3d01018084 (patch)
tree54abd50a0a0e9d4245e64321a4a0ef4726218db2
parent5e0186828525170793749dee96589eedb7694f70 (diff)
Implemented menus and submenus.
-rw-r--r--exampleSite/config/_default/config.toml42
-rw-r--r--layouts/partials/header.html26
2 files changed, 52 insertions, 16 deletions
diff --git a/exampleSite/config/_default/config.toml b/exampleSite/config/_default/config.toml
index 3c67c74..74cc225 100644
--- a/exampleSite/config/_default/config.toml
+++ b/exampleSite/config/_default/config.toml
@@ -10,15 +10,49 @@ disqusShortname = ""
[menu]
[[menu.main]]
identifier = "generic"
- name = "Generic Page"
+ name = "Generic"
url = "/generic/"
+ weight = 10
+ [[menu.main]]
+ identifier = "contact"
+ name = "Contact"
+ url = "/contact/"
weight = 20
[[menu.main]]
identifier = "elements"
- name = "Elements Reference"
+ name = "Elements"
url = "/elements/"
- weight = 50
-
+ weight = 30
+ [[menu.main]]
+ identifier = "submenu"
+ name = "Submenu"
+ url = "#"
+ weight = 40
+ [[menu.main]]
+ parent = "submenu"
+ identifier = "one"
+ name = "Option One"
+ url = "#"
+ weight = 41
+ [[menu.main]]
+ parent = "submenu"
+ identifier = "two"
+ name = "Option Two"
+ url = "#"
+ weight = 42
+ [[menu.main]]
+ parent = "submenu"
+ identifier = "three"
+ name = "Option Three"
+ url = "#"
+ weight = 43
+ [[menu.main]]
+ parent = "submenu"
+ identifier = "four"
+ name = "Option Four"
+ url = "#"
+ weight = 44
+
# [params]
# set below parameter to define a favicon
# favicon = "favicon.ico"
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 019713a..b4b3690 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -7,18 +7,20 @@
<li>
<a href="#" class="icon solid fa-angle-down">Layouts</a>
<ul>
- <li><a href="generic.html">Generic</a></li>
- <li><a href="contact.html">Contact</a></li>
- <li><a href="elements.html">Elements</a></li>
- <li>
- <a href="#">Submenu</a>
- <ul>
- <li><a href="#">Option One</a></li>
- <li><a href="#">Option Two</a></li>
- <li><a href="#">Option Three</a></li>
- <li><a href="#">Option Four</a></li>
- </ul>
- </li>
+ {{ range .Site.Menus.main }}
+ {{ if .HasChildren }}
+ <li>
+ <a href="{{ .URL }}">{{ .Name }}</a>
+ <ul>
+ {{ range .Children }}
+ <li><a href="{{ .URL }}">{{ .Name }}</a></li>
+ {{ end }}
+ </ul>
+ </li>
+ {{ else }}
+ <li><a href="{{ .URL }}">{{ .Name }}</a></li>
+ {{ end }}
+ {{ end }}
</ul>
</li>
<li><a href="#" class="button">Sign Up</a></li>