mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-06 10:15:02 +00:00
fix(nav): extend navbar active link highlighting to non-home pages
The original commit of the feature inabbd540didn't work when `baseurl` contained a sub-dir like we have for the docs site. Fixabbd540See #991
This commit is contained in:
1 parent
abbd54045c
commit
8a6d151efb
3 files changed
+5
-5
No files matched your search
@@ -25,7 +25,7 @@
|
||||
|
||||
[[main]]
|
||||
name = "Tutorials"
|
||||
url = "/tutorial/"
|
||||
url = "tutorial/"
|
||||
weight = 50
|
||||
|
||||
[[main]]
|
||||
|
||||
@@ -37,7 +37,7 @@ For example, if you delete this folder, you can remove the following from your m
|
||||
```toml
|
||||
[[main]]
|
||||
name = "Tutorials"
|
||||
url = "/tutorial/"
|
||||
url = "tutorial/"
|
||||
weight = 50
|
||||
```
|
||||
|
||||
@@ -46,6 +46,6 @@ Or, if you are creating an online course, you can rename the `tutorial` folder t
|
||||
```toml
|
||||
[[main]]
|
||||
name = "My Course"
|
||||
url = "/course/"
|
||||
url = "course/"
|
||||
weight = 50
|
||||
```
|
||||
@@ -63,11 +63,11 @@
|
||||
{{ $is_same_page := $is_link_in_current_path }}
|
||||
{{ if gt (len $hash) 0 }}
|
||||
{{ $hash = index $hash 0 }}
|
||||
{{ $hash_removed := (replace .URL $hash "") }}
|
||||
{{ $hash_removed := replace .URL $hash "" }}
|
||||
{{ if eq (len $hash_removed) 0 }}
|
||||
{{ $hash_removed = "/" }}{{/* Add robustness for `/#SECTION` or `#SECTION` in `menus.toml`. */}}
|
||||
{{ end }}
|
||||
{{ $is_same_page = eq $current_page.RelPermalink $hash_removed }}
|
||||
{{ $is_same_page = eq (path.Dir $current_page.RelPermalink) (path.Dir ($hash_removed|relLangURL)) }}
|
||||
{{ end }}
|
||||
|
||||
<li class="nav-item">
|
||||
|
||||
Reference in new issue
Block a user