Skip to content

Commit fe3c859

Browse files
authored
Replace partialCached with partial (#16524)
1 parent d6052b6 commit fe3c859

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

layouts/partials/navigation_level.html

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
{{ $pages := .pages }}
23
{{ $parent := .parent }}
34
{{ $current := .current }}
@@ -23,7 +24,7 @@
2324
{{ end }}
2425
{{ end }}
2526

26-
<ul role="{{ if $top }}tree{{ else }}group{{ end }}" aria-expanded="{{ if $collapse }}false{{ else }}true{{ end }}"{{ if $leafSection }} class="leaf-section"{{ end }} {{ if $labelledby }}aria-labelledby="{{ $labelledby }}"{{ end }}>
27+
<ul role="{{ if $top }}tree{{ else }}group{{ end }}" aria-expanded="{{ if $collapse }}false{{ else }}true{{ end }}"{{ if $leafSection }} class="leaf-section"{{ end }} {{ if $labelledby}}aria-labelledby="{{ $labelledby }}"{{ end }}>
2728
{{ range $pages }}
2829
{{ $pageLocation := (path.Dir (path.Dir .File.Dir)) }}
2930
{{ if and (eq $parentDir $pageLocation) (not .Params.draft) }}
@@ -42,28 +43,22 @@
4243
{{ end }}
4344

4445
{{ if not .IsPage }}
45-
<li role="treeitem" aria-label="{{ $linktitle }}">
46+
<li role="treeitem" aria-label="{{ $linktitle}}">
4647
{{ $collapse := not (.IsAncestor $current) }}
4748
{{ if eq . $current }}
4849
{{ $collapse = true }}
4950
{{ end }}
5051

51-
{{ if lt (len $pageLocation) 6 }}
52-
<a class='main' title="{{ $desc }}" href="{{ .Permalink }}">{{ $linktitle }}</a>
53-
{{ if and .CurrentSection (ne .CurrentSection .) (ne .CurrentSection $parent) (ne .CurrentSection $current) .CurrentSection.Pages }}
54-
{{ partial "navigation_level.html" (dict "pages" .CurrentSection.Pages "parent" . "current" $current "collapse" false "top" false "labelledby" "") }}
55-
{{ end }}
56-
{{ else if .CurrentSection.IsAncestor $current }}
57-
<button {{ if not $collapse }} class="show" {{ end }} aria-hidden="true" tabindex="-1"></button><a title="{{ $desc }}" href="{{ .Permalink }}">{{ $linktitle }}</a>
58-
{{ if and .CurrentSection (ne .CurrentSection .) (ne .CurrentSection $parent) (ne .CurrentSection $current) .CurrentSection.Pages }}
59-
{{ partial "navigation_level.html" (dict "pages" .CurrentSection.Pages "parent" . "current" $current "collapse" $collapse "top" false "labelledby" "") }}
60-
{{ end }}
61-
{{ else }}
62-
<button {{ if not $collapse }} class="show" {{ end }} aria-hidden="true" tabindex="-1"></button><a title="{{ $desc }}" href="{{ .Permalink }}">{{ $linktitle }}</a>
63-
{{ if and .CurrentSection (ne .CurrentSection .) (ne .CurrentSection $parent) (ne .CurrentSection $current) .CurrentSection.Pages }}
64-
{{ partial "navigation_level.html" (dict "pages" .CurrentSection.Pages "parent" . "current" $current "collapse" $collapse "top" false "labelledby" "") }}
65-
{{ end }}
66-
{{ end }}
52+
{{if lt (len $pageLocation) 6 -}}
53+
<a class='main' title="{{ $desc }}" href="{{ .Permalink }}">{{ $linktitle}}</a>
54+
{{ partial "navigation_level.html" (dict "pages" $pages "parent" . "current" $current "collapse" false "top" false "labelledby" "" ) .CurrentSection }}
55+
{{ else if (.CurrentSection.IsAncestor $current) }}
56+
<button {{ if not $collapse }} class="show" {{ end }} aria-hidden="true" tabindex="-1" ></button><a title="{{ $desc }}" href="{{ .Permalink }}">{{ $linktitle}}</a>
57+
{{ partial "navigation_level.html" (dict "pages" $pages "parent" . "current" $current "collapse" $collapse "top" false "labelledby" "" ) }}
58+
{{- else -}}
59+
<button {{ if not $collapse }} class="show" {{ end }} aria-hidden="true" tabindex="-1" ></button><a title="{{ $desc }}" href="{{ .Permalink }}">{{ $linktitle}}</a>
60+
{{ partial "navigation_level.html" (dict "pages" $pages "parent" . "current" $current "collapse" $collapse "top" false "labelledby" "" ) .CurrentSection }}
61+
{{- end -}}
6762
</li>
6863
{{ else }}
6964
<li role="none">
@@ -72,4 +67,4 @@
7267
{{ end }}
7368
{{ end }}
7469
{{ end }}
75-
</ul>
70+
</ul>

0 commit comments

Comments
 (0)