File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,14 +5,14 @@ topnav:
55- title : Topnav
66 items :
77 - title : Quickstart
8- url : /quickstart.html
8+ url : /tutorials/ quickstart/
99 section :
1010 - title : Docs
1111 url : /docs/fundamentals/overview/
1212 section : docs
1313 - title : Tutorials
1414 url : /tutorials/overview/
15- section : tutorial
15+ section : tutorials
1616 - title : Community
1717 url : /community/overview/
1818 section : community
Original file line number Diff line number Diff line change 55{{- range $entry := $topnav.topnav -}}
66 {{- range $item := $entry.items -}}
77 {{- $sectionSidebar := printf "%s_sidebar" ($item.section | default "") -}}
8- {{- if or (and $item.url (in $.RelPermalink $item.url)) (eq ($.Param "sidebar") $sectionSidebar) -}}
8+ {{- if or (and $item.url (in $.RelPermalink $item.url)) (eq ($.Param "sidebar") $sectionSidebar) (and $item.section (eq $.Section $item.section)) -}}
99 {{- $sectionTitle = $item.title -}}
1010 {{- $sectionURL = $item.url -}}
1111 {{- end -}}
Original file line number Diff line number Diff line change 1616 </ div >
1717 < div class ="collapse navbar-collapse " id ="bs-example-navbar-collapse-1 ">
1818 < ul class ="nav navbar-nav ms-auto ">
19+ {{- $hasExactMatch := false -}}
20+ {{- range $entry := $topnav.topnav -}}
21+ {{- range $item := $entry.items -}}
22+ {{- with $item.url -}}
23+ {{- if partial "sidebar_page_matches_url.html" (dict "page" $page "url" .) -}}
24+ {{- $hasExactMatch = true -}}
25+ {{- end -}}
26+ {{- end -}}
27+ {{- end -}}
28+ {{- end -}}
1929 {{ range $entry := $topnav.topnav }}
2030 {{ range $item := $entry.items }}
2131 {{ $sectionSidebar := printf "%s_sidebar" ($item.section | default "") }}
2232 {{ $isActive := false }}
2333 {{ with $item.url }}
2434 {{ $isActive = partial "sidebar_page_matches_url.html" (dict "page" $page "url" .) }}
2535 {{ end }}
26- {{ if and (not $isActive) $item.section }}
27- {{ $isActive = eq ($page.Param "sidebar") $sectionSidebar }}
36+ {{ if and (not $hasExactMatch) (not $ isActive) $item.section }}
37+ {{ $isActive = or ( eq ($page.Param "sidebar") $sectionSidebar) (eq $page.Section $item.section) }}
2838 {{ end }}
2939 < li class ="nav-item{{ if $isActive }} active{{ end }} ">
3040 {{ if $item.external_url }}
You can’t perform that action at this time.
0 commit comments