diff options
author | Chen Xianmin <xianmin12@gmail.com> | 2022-09-06 15:25:56 +0300 |
---|---|---|
committer | Chen Xianmin <xianmin12@gmail.com> | 2022-09-06 15:25:56 +0300 |
commit | 942f9d91bfdb94f4ee2699c7525ef582c0a7f79e (patch) | |
tree | af41dbaba46958e9ec6b37f07bd7e8e8126ee125 | |
parent | f5d49e7bd8b727729e9e692a9cd0a1cff45b9e2d (diff) |
fix: menu active
see: https://github.com/gohugoio/hugo/issues/9150#issuecomment-965798975
-rw-r--r-- | dev-config.toml | 18 | ||||
-rw-r--r-- | exampleSite/config.toml | 12 | ||||
-rw-r--r-- | exampleSite/full-config.toml | 12 | ||||
-rw-r--r-- | layouts/partials/header.html | 2 | ||||
-rw-r--r-- | theme.toml | 2 |
5 files changed, 23 insertions, 23 deletions
diff --git a/dev-config.toml b/dev-config.toml index 8f9006a..3018eb3 100644 --- a/dev-config.toml +++ b/dev-config.toml @@ -39,13 +39,13 @@ defaultContentLanguage = "en" # Default language to use (if you setup multiling name = "Home" weight = 10 identifier = "home" - url = "/" + pageref = "/" [[languages.en.menu.main]] name = "Docs" weight = 11 identifier = "docs" - url = "/categories/docs/" + pageref = "/categories/docs/" # docs submenu #[[languages.en.menu.main]] @@ -58,17 +58,17 @@ defaultContentLanguage = "en" # Default language to use (if you setup multiling name = "Archives" weight = 20 identifier = "archives" - url = "/post/" + pageref = "/post/" [[languages.en.menu.main]] name = "Tags" weight = 30 identifier = "tags" - url = "/tags/" + pageref = "/tags/" [[languages.en.menu.main]] name = "Categories" weight = 40 identifier = "categories" - url = "/categories/" + pageref = "/categories/" [[languages.en.menu.main]] name = "external-link" weight = 50 @@ -78,22 +78,22 @@ defaultContentLanguage = "en" # Default language to use (if you setup multiling name = "主页" weight = 10 identifier = "home" - url = "zh-cn/" + pageref = "zh-cn/" [[languages.zh-cn.menu.main]] name = "归档" weight = 20 identifier = "archives" - url = "zh-cn/post/" + pageref = "zh-cn/post/" [[languages.zh-cn.menu.main]] name = "标签" weight = 30 identifier = "tags" - url = "zh-cn/tags/" + pageref = "zh-cn/tags/" [[languages.zh-cn.menu.main]] name = "分类" weight = 40 identifier = "categories" - url = "zh-cn/categories/" + pageref = "zh-cn/categories/" [[languages.zh-cn.menu.main]] name = "外部链接" weight = 50 diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 11b08fe..a43eaae 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -32,26 +32,26 @@ defaultContentLanguage = "en" # Default language to use name = "This is Home" weight = 10 identifier = "home" - url = "/" + pageref = "/" [[menu.main]] name = "Archives" weight = 20 identifier = "archives" - url = "/post/" + pageref = "/post/" [[menu.main]] name = "Tags" weight = 30 identifier = "tags" - url = "/tags/" + pageref = "/tags/" [[menu.main]] name = "Categories" weight = 40 identifier = "categories" - url = "/categories/" + pageref = "/categories/" [[menu.main]] name = "external-link" weight = 50 - url = "https://gohugo.io" + pageref = "https://gohugo.io" [params] @@ -72,7 +72,7 @@ defaultContentLanguage = "en" # Default language to use toc = true # 是否开启目录 photoswipe = true # see https://github.com/dimsemenov/PhotoSwipe # 是否启用PhotoSwipe(图片可点击) contentCopyright = '<a rel="license noopener" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank">CC BY-NC-ND 4.0</a>' - + # Link custom CSS and JS assets # (relative to /static/css and /static/js respectively) customCSS = [] # if ['custom.css'], load '/static/css/custom.css' file diff --git a/exampleSite/full-config.toml b/exampleSite/full-config.toml index 2f847de..9642a6e 100644 --- a/exampleSite/full-config.toml +++ b/exampleSite/full-config.toml @@ -43,26 +43,26 @@ defaultContentLanguage = "en" # Default language to use name = "Home" weight = 10 identifier = "home" - url = "/" + pageref = "/" [[menu.main]] name = "Archives" weight = 20 identifier = "archives" - url = "/post/" + pageref = "/post/" [[menu.main]] name = "Tags" weight = 30 identifier = "tags" - url = "/tags/" + pageref = "/tags/" [[menu.main]] name = "Categories" weight = 40 identifier = "categories" - url = "/categories/" + pageref = "/categories/" [[menu.main]] name = "external-link" weight = 50 - url = "https://gohugo.io" + pageref = "https://gohugo.io" [params] @@ -94,7 +94,7 @@ defaultContentLanguage = "en" # Default language to use showMenuLanguageChooser = true showAuthorInfo = true # show author info below the article - + # Optional custom wallpaper image URL. Can be a remote image or local /static/img/wallpaper.jpg (make sure it has a small filesize for quick site painting) # wallpaper = "/static/img/wallpaper.jpg" wallpaper = "https://followingmyfeet.com/wp-content/uploads/2018/02/825_2229-HDR.jpg" diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 0895ca2..f9e1d97 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -12,7 +12,7 @@ <ul id="menu" class="menu"> {{ $currentPage := . }} {{ range .Site.Menus.main }} - <li class="menu-item{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}"> + <li class="menu-item{{ if $currentPage.IsMenuCurrent "main" . }} active{{end}}"> {{ if .HasChildren }} <!-- drop down navigation MENU --> <a class="menu-item-link menu-parent" href="{{ .URL | absLangURL | safeURL }}">{{ .Name }}</a> @@ -8,7 +8,7 @@ description = "A readable theme for Hugo" homepage = "https://github.com/xianmin/hugo-theme-jane" tags = ["responsive", "blog", "simple", "clean", "readable", "highlight", "multilingual"] features = ["responsive", "blog", "simple", "clean", "highlight", "multilingual"] -min_version = "0.45" +min_version = "0.86" [author] name = "xianmin" |