Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
fix(style): fix active header menu item
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonzq committed Feb 20, 2020
1 parent 20c9c81 commit f3eb6fc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion assets/css/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ $header-height-desktop: 4rem !default;
$header-height-mobile: 4rem !default;

// Color of the header background
$header-background-color: #fafafa !default;
$header-background-color: #f8f8f8 !default;
$header-background-color-dark: #252627 !default;

// Color of the hover header item
Expand Down
16 changes: 8 additions & 8 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,22 @@ themesDir = "../.."
[[languages.en.menu.main]]
identifier = "posts"
name = "Posts"
url = "posts"
url = "/posts/"
weight = 1
[[languages.en.menu.main]]
identifier = "tags"
name = "Tags"
url = "tags"
url = "/tags/"
weight = 2
[[languages.en.menu.main]]
identifier = "categories"
name = "Categories"
url = "categories"
url = "/categories/"
weight = 3
[[languages.en.menu.main]]
identifier = "about"
name = "About"
url = "about"
url = "/about/"
weight = 4
[[languages.en.menu.main]]
identifier = "zh"
Expand Down Expand Up @@ -332,22 +332,22 @@ themesDir = "../.."
[[languages.zh.menu.main]]
identifier = "posts"
name = "文章"
url = "posts"
url = "/posts/"
weight = 1
[[languages.zh.menu.main]]
identifier = "tags"
name = "标签"
url = "tags"
url = "/tags/"
weight = 2
[[languages.zh.menu.main]]
identifier = "categories"
name = "分类"
url = "categories"
url = "/categories/"
weight = 3
[[languages.zh.menu.main]]
identifier = "about"
name = "关于"
url = "about"
url = "/about/"
weight = 4
[[languages.zh.menu.main]]
identifier = "en"
Expand Down
3 changes: 1 addition & 2 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
</a>
</div>
<div class="menu">
{{- $currentPage := . }}
{{- range .Site.Menus.main -}}
<a class="menu-item{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) | or (eq $currentPage.RelPermalink .URL) }} active{{ end }}" href="{{ .URL | relLangURL }}" title="{{ .Title }}">
<a class="menu-item{{ if $.IsMenuCurrent "main" . | or ($.HasMenuCurrent "main" .) | or (.URL | relLangURL | string | eq $.RelPermalink ) }} active{{ end }}" href="{{ .URL | relLangURL }}"{{ with .Title }} title="{{ . }}"{{ end }}>
{{- .Pre | safeHTML }}{{ .Name -}}
</a>
{{- end -}}
Expand Down

Large diffs are not rendered by default.

0 comments on commit f3eb6fc

Please sign in to comment.