Skip to content

Commit

Permalink
feat: add menu active
Browse files Browse the repository at this point in the history
  • Loading branch information
xianmin committed Nov 8, 2018
1 parent 588d5bf commit 007f95a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
6 changes: 5 additions & 1 deletion assets/sass/_partial/_header/_menu.scss
Expand Up @@ -8,6 +8,10 @@
padding-right: 15px; padding-right: 15px;
font-family: $global-serif-font-family; font-family: $global-serif-font-family;


.active {
font-weight: 700;
}

.menu-item { .menu-item {
display: inline-block; display: inline-block;
margin-left: 1em; margin-left: 1em;
Expand Down Expand Up @@ -46,7 +50,7 @@
visibility: visible; visibility: visible;
transition-delay: 0s; /* react immediately on hover */ transition-delay: 0s; /* react immediately on hover */
} }

// @include underline-from-center; // @include underline-from-center;
} }


Expand Down
6 changes: 3 additions & 3 deletions dev-config.toml
Expand Up @@ -55,17 +55,17 @@ defaultContentLanguage = "en" # Default language to use (if you setup multiling
name = "Archives" name = "Archives"
weight = 20 weight = 20
identifier = "archives" identifier = "archives"
url = "post/" url = "/post/"
[[languages.en.menu.main]] [[languages.en.menu.main]]
name = "Tags" name = "Tags"
weight = 30 weight = 30
identifier = "tags" identifier = "tags"
url = "tags/" url = "/tags/"
[[languages.en.menu.main]] [[languages.en.menu.main]]
name = "Categories" name = "Categories"
weight = 40 weight = 40
identifier = "categories" identifier = "categories"
url = "categories/" url = "/categories/"
[[languages.en.menu.main]] [[languages.en.menu.main]]
name = "external-link" name = "external-link"
weight = 50 weight = 50
Expand Down
3 changes: 2 additions & 1 deletion layouts/partials/header.html
Expand Up @@ -10,8 +10,9 @@


<nav class="site-navbar"> <nav class="site-navbar">
<ul id="menu" class="menu"> <ul id="menu" class="menu">
{{ $currentPage := . }}
{{ range .Site.Menus.main }} {{ range .Site.Menus.main }}
<li class="menu-item"> <li class="menu-item{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}">
{{ if .HasChildren }} {{ if .HasChildren }}
<!-- drop down navigation MENU --> <!-- drop down navigation MENU -->
<a class="menu-item-link menu-parent" href="{{ .URL | absLangURL | safeURL }}">{{ .Name }}</a> <a class="menu-item-link menu-parent" href="{{ .URL | absLangURL | safeURL }}">{{ .Name }}</a>
Expand Down

Large diffs are not rendered by default.

@@ -1 +1 @@
{"Target":"sass/jane.min.f64ace117d14efc3943239ebd780fcd68a86127f6c63367968f91b22694b2a60.css","MediaType":"text/css","Data":{"Integrity":"sha256-9krOEX0U78OUMjnr14D81oqGEn9sYzZ5aPkbImlLKmA="}} {"Target":"sass/jane.min.f384a7fa4673433bc34e238c5074bb1303d90e5d5a29a2ffbaf61226ef213c29.css","MediaType":"text/css","Data":{"Integrity":"sha256-84Sn+kZzQzvDTiOMUHS7EwPZDl1aKaL/uvYSJu8hPCk="}}

0 comments on commit 007f95a

Please sign in to comment.