Skip to content
Permalink
Browse files

improve navigation highlighting: (#211)

* improve navigation highlighting:

- highlight blog section when on taxonomy sites (`/tags/` and `/categories/`)

- highlight home, too

* nav highlighting: fall back to `url` if `identifier` key is not set for menu
  • Loading branch information...
salim-b authored and ryanfox1985 committed May 10, 2019
1 parent 2765194 commit 1291f437fd8d347c4457c37af26fb2876aa6f545
Showing with 8 additions and 3 deletions.
  1. +3 −1 README.md
  2. +4 −1 exampleSite/config.toml
  3. +1 −1 layouts/partials/nav.html
@@ -159,7 +159,9 @@ You can also define the menu items that will appear in the top bar. Edit the `[[
weight = 4
```

The `weight` parameter will determine the order of the menu entries.
The `weight` key will determine the order of the menu entries.

**Important:** Do not change the `identifier` key of existing menu entries!


### Sidebar widgets
@@ -18,22 +18,25 @@ paginate = 10
# Main menu

[[menu.main]]
identifier="home"
name = "Home"
url = "/"
weight = 1

[[menu.main]]
identifier="blog"
name = "Blog"
url = "/blog/"
weight = 2

[[menu.main]]
name = "FAQ"
identifier = "faq"
name = "FAQ"
url = "/faq/"
weight = 3

[[menu.main]]
identifier = "contact"
name = "Contact"
url = "/contact/"
weight = 4
@@ -23,7 +23,7 @@
{{ $current := . }}
{{ range .Site.Menus.main }}
{{ $topLevel := replace .URL "/" "" }}
<li class="dropdown{{ if not $current.IsHome }}{{ if or (eq $current.RelPermalink .URL) (eq $current.Type $topLevel) }} active{{ end }}{{ end }}">
<li class="dropdown{{ if eq $current.RelPermalink .URL | or (eq $current.Type $topLevel) | or (and (eq (default (trim .URL "/") .Identifier) "blog") (in (slice "taxonomy" "taxonomyTerm") $current.Kind)) }} active{{ end }}">
{{ if .HasChildren }}
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ .Name }} <span class="caret"></span></a>
<ul class="dropdown-menu">

0 comments on commit 1291f43

Please sign in to comment.
You can’t perform that action at this time.