|
39 | 39 | {{ $p := . -}} |
40 | 40 | {{ $s := .Site -}} |
41 | 41 | {{ range .Site.Menus.main -}} |
42 | | - {{ if .HasChildren }} |
43 | | - <!-- Menu items with children --> |
44 | | - <div class="dropdown"> |
45 | | - <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
46 | | - {{- .Pre -}} |
47 | | - <span>{{ .Name }}</span> |
48 | | - </a> |
49 | | - <ul class="dropdown-menu"> |
50 | | - {{ $children := .Children.ByWeight -}} |
51 | | - {{ if eq .Identifier "releases" -}} |
52 | | - {{ with (partial "releasePages.html" (dict "site" $s)).active -}} |
53 | | - {{ range . -}} |
54 | | - <a class="dropdown-item" href="{{ .RelPermalink }}">{{ .Params.LinkTitle | default .Params.Title }}</a> |
55 | | - {{- end -}} |
56 | | - {{ else -}} |
57 | | - {{ $children = where .Children.ByWeight "Identifier" "ne" "all-releases-page" -}} |
58 | | - {{ end -}} |
59 | | - {{ end -}} |
60 | | - {{ range $children -}} |
61 | | - <a class="dropdown-item" href="{{ .URL }}">{{ .Name }}</a> |
62 | | - {{- end -}} |
63 | | - </ul> |
64 | | - </div> |
65 | | - {{ else -}} |
66 | | - <!-- Menu items without children --> |
67 | | - {{ $topHidden := false }} |
68 | | - {{ if .Page }} |
69 | | - {{ $topHidden = .Page.Params.top_hidden | default false }} |
70 | | - {{ else }} |
71 | | - {{ $topHidden = .Params.top_hidden | default false }} |
72 | | - {{ end }} |
73 | | - {{ if not $topHidden }} |
74 | | - <li class="nav-item"> |
75 | | - {{ $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) -}} |
76 | | - {{ $href := "" -}} |
77 | | - {{ with .Page -}} |
78 | | - {{ $active = or $active ( $.IsDescendant .) -}} |
79 | | - {{ $href = .RelPermalink -}} |
80 | | - {{ else -}} |
81 | | - {{ $href = .URL | relLangURL -}} |
82 | | - {{ end -}} |
83 | | - {{ $isExternal := ne $baseURL.Host (urls.Parse .URL).Host -}} |
84 | | - <a {{/**/ -}} |
85 | | - class="nav-link {{- if $active }} active {{- end }}" {{/**/ -}} |
86 | | - href="{{ $href }}" |
87 | | - {{- if $isExternal }} target="_blank" rel="noopener" {{- end -}} |
88 | | - > |
89 | | - {{- .Pre -}} |
90 | | - <span>{{ .Name }}</span> |
91 | | - {{- .Post -}} |
92 | | - </a> |
93 | | - </li> |
94 | | - {{ end -}} |
95 | | - {{ end -}} |
| 42 | + <li class="nav-item"> |
| 43 | + {{ if .HasChildren }} |
| 44 | + <!-- Menu items with children --> |
| 45 | + <button class="btn btn-link nav-link dropdown-toggle d-flex align-items-center" type="button" data-bs-toggle="dropdown" aria-expanded="false"> |
| 46 | + {{- .Pre -}} |
| 47 | + <span>{{ .Name }}</span> |
| 48 | + </button> |
| 49 | + <ul class="dropdown-menu"> |
| 50 | + {{ $children := .Children.ByWeight -}} |
| 51 | + {{ if eq .Identifier "releases" -}} |
| 52 | + {{ with (partial "releasePages.html" (dict "site" $s)).active -}} |
| 53 | + {{ range . -}} |
| 54 | + <a class="dropdown-item" href="{{ .RelPermalink }}">{{ .Params.LinkTitle | default .Params.Title }}</a> |
| 55 | + {{- end -}} |
| 56 | + {{ else -}} |
| 57 | + {{ $children = where .Children.ByWeight "Identifier" "ne" "all-releases-page" -}} |
| 58 | + {{ end -}} |
| 59 | + {{ end -}} |
| 60 | + {{ range $children -}} |
| 61 | + <li><a class="dropdown-item" href="{{ .URL }}">{{ .Name }}</a></li> |
| 62 | + {{- end -}} |
| 63 | + </ul> |
| 64 | + {{ else -}} |
| 65 | + <!-- Menu items without children --> |
| 66 | + {{ $topHidden := false }} |
| 67 | + {{ if .Page }} |
| 68 | + {{ $topHidden = .Page.Params.top_hidden | default false }} |
| 69 | + {{ else }} |
| 70 | + {{ $topHidden = .Params.top_hidden | default false }} |
| 71 | + {{ end }} |
| 72 | + {{ if not $topHidden }} |
| 73 | + {{ $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) -}} |
| 74 | + {{ $href := "" -}} |
| 75 | + {{ with .Page -}} |
| 76 | + {{ $active = or $active ( $.IsDescendant .) -}} |
| 77 | + {{ $href = .RelPermalink -}} |
| 78 | + {{ else -}} |
| 79 | + {{ $href = .URL | relLangURL -}} |
| 80 | + {{ end -}} |
| 81 | + {{ $isExternal := ne $baseURL.Host (urls.Parse .URL).Host -}} |
| 82 | + <a {{/**/ -}} |
| 83 | + class="nav-link {{- if $active }} active {{- end }}" {{/**/ -}} |
| 84 | + href="{{ $href }}" |
| 85 | + {{- if $isExternal }} target="_blank" rel="noopener" {{- end -}} |
| 86 | + > |
| 87 | + {{- .Pre -}} |
| 88 | + <span>{{ .Name }}</span> |
| 89 | + {{- .Post -}} |
| 90 | + </a> |
| 91 | + {{ end -}} |
| 92 | + {{ end -}} |
| 93 | + </li> |
96 | 94 | {{ end -}} |
97 | 95 | <!-- Other navbar items --> |
98 | 96 | {{ if .Site.Params.versions -}} |
|
0 commit comments