diff options
author | somratpro <abdulmonnafsomrat@gmail.com> | 2021-02-02 07:41:21 +0300 |
---|---|---|
committer | somratpro <abdulmonnafsomrat@gmail.com> | 2021-02-02 07:41:21 +0300 |
commit | b523fb5e8f0a63ee2812bfd19e12546d5c6124ad (patch) | |
tree | 4bf5f19b9141e0e8c7e3dc5002b66adf99ea4d12 | |
parent | c82a5e47ae0f41e05219c71ccca8864b0b2cd815 (diff) |
added navigation dropdown
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | exampleSite/config.toml | 4 | ||||
-rw-r--r-- | layouts/partials/header.html | 23 |
3 files changed, 23 insertions, 6 deletions
@@ -29,7 +29,7 @@ Timer Hugo is designed by Themefisher team and contributed by <a href="https://g |---|---|---|---| | ![About page](https://user-images.githubusercontent.com/37659754/54080449-36da5600-431a-11e9-8848-424a385c4ba2.png) | ![Service page](https://user-images.githubusercontent.com/37659754/54080452-380b8300-431a-11e9-8f5f-7ba7fd07a864.png) | ![Gallary page](https://user-images.githubusercontent.com/37659754/54080451-3772ec80-431a-11e9-8b72-4e6c6b8a64a2.png) | ![Contact page](https://user-images.githubusercontent.com/37659754/54080450-36da5600-431a-11e9-90db-0a55971c1fe3.png) -[Live Demo](http://demo.themefisher.com/timer-hugo/). +[Live Demo](https://demo.gethugothemes.com/timer/). ## Installation diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 75932ce..c514eb4 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -7,6 +7,10 @@ theme = "timer-hugo" # Navbar Menus [[menu.main]] +name = "Home" +url = "/" +weight = 1 +[[menu.main]] name = "About" url = "about" weight = 2 diff --git a/layouts/partials/header.html b/layouts/partials/header.html index c25b0ea..97c1ffa 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -12,15 +12,28 @@ </button> <div class="collapse navbar-collapse" id="navigation"> - <ul class="navbar-nav ml-auto"> - <li class="nav-item"> - <a class="nav-link" href="{{ .Site.BaseURL }}">{{ .Site.Params.home }}</a> + <ul class="navbar-nav ml-auto">{{ range site.Menus.main }} + {{ if .HasChildren }} + <li class="nav-item dropdown"> + <a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" + aria-expanded="false"> + {{ .Name }} + </a> + <div class="dropdown-menu"> + {{ range .Children }} + <a class="dropdown-item" + href="{{if .Pre}}{{site.BaseURL | absLangURL}}{{.Pre}}{{ .URL }}{{else}}{{.URL | absLangURL}}{{end}}">{{ .Name }}</a> + {{ end }} + </div> </li> - {{ range .Site.Menus.main }} + {{ else }} <li class="nav-item"> - <a class="nav-link" href="{{ .URL | absURL }}">{{ .Name }}</a> + <a class="nav-link" + href="{{if .Pre}}{{site.BaseURL | absLangURL}}{{.Pre}}{{ .URL }}{{else}}{{.URL | absLangURL}}{{end}}">{{ .Name }}</a> </li> {{ end }} + {{ end }} + </ul> </div> </nav> </div> |