diff --git a/exampleSite/config/_default/menus.toml b/exampleSite/config/_default/menus.toml index 81883c89..e1c10c15 100644 --- a/exampleSite/config/_default/menus.toml +++ b/exampleSite/config/_default/menus.toml @@ -25,7 +25,7 @@ [[main]] name = "Tutorials" - url = "/tutorial/" + url = "tutorial/" weight = 50 [[main]] diff --git a/exampleSite/content/tutorial/_index.md b/exampleSite/content/tutorial/_index.md index 3bafb63b..51d10d6d 100644 --- a/exampleSite/content/tutorial/_index.md +++ b/exampleSite/content/tutorial/_index.md @@ -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 ``` diff --git a/layouts/partials/navbar.html b/layouts/partials/navbar.html index c7006f4a..2f6cd766 100644 --- a/layouts/partials/navbar.html +++ b/layouts/partials/navbar.html @@ -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 }}