mirror of
https://github.com/trwnh/hugo-theme-paradox.git
synced 2024-12-25 23:58:47 +00:00
fix docs menu depth collapsing
This commit is contained in:
parent
317e9651c9
commit
73d11f00b8
1 changed files with 29 additions and 48 deletions
|
@ -9,64 +9,45 @@
|
|||
<a id="menu" href="#top">Skip menu</a>
|
||||
{{ $currentPage := . }}
|
||||
{{ range .Site.Menus.docs }}
|
||||
{{ $active := or ($currentPage.IsMenuCurrent "docs" .) (eq $currentPage.Section .Identifier)}}
|
||||
{{ if .HasChildren }}
|
||||
<details
|
||||
class='section-title
|
||||
{{- if $active }} active{{ end -}}
|
||||
'
|
||||
{{- if $active }} open{{ end -}}>
|
||||
<summary href="{{ .URL | relLangURL }}">
|
||||
{{ .Pre }}
|
||||
<span>{{ .Name }}</span>
|
||||
{{ .Post }}
|
||||
</summary>
|
||||
<ul class="sub-menu">
|
||||
{{ $active := or ($currentPage.IsMenuCurrent "docs" .) (eq $currentPage.Section .Identifier)}}
|
||||
<details class='section-title{{- if $active }} active{{ end -}}' {{- if $active }} open{{ end -}}>
|
||||
{{ if .HasChildren }}
|
||||
<summary href="{{ .URL | relLangURL }}">
|
||||
{{ .Pre }}<span>{{ .Name }}</span>{{ .Post }}
|
||||
</summary>
|
||||
<ul class="sub-menu" data-depth=1>
|
||||
{{ range .Children }}
|
||||
{{ if .HasChildren}}
|
||||
<li
|
||||
class='{{- if $active }} active{{ end -}}'>
|
||||
<a href="{{ .URL | relLangURL }}">
|
||||
{{ .Pre }}
|
||||
<span>{{ .Name }}</span>
|
||||
{{ .Post }}
|
||||
</a>
|
||||
<ul class="sub-menu">
|
||||
{{ if .HasChildren}}
|
||||
<li class='{{- if $active }} active{{ end -}}'>
|
||||
<a href="{{ .URL | relLangURL }}">
|
||||
{{ .Pre }}<span>{{ .Name }}</span>{{ .Post }}
|
||||
</a>
|
||||
<ul class="sub-menu" data-depth=2>
|
||||
{{ range .Children }}
|
||||
<li
|
||||
class='{{- if $active }} active{{ end -}}'>
|
||||
<li class='{{- if $active }} active{{ end -}}'>
|
||||
<a href="{{ .URL | relLangURL }}">
|
||||
{{ .Pre }}
|
||||
<span>{{ .Name }}</span>
|
||||
{{ .Post }}
|
||||
{{ .Pre }}<span>{{ .Name }}</span>{{ .Post }}
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}{{/* range .Children (subsubmenu) */}}
|
||||
</ul>
|
||||
{{ else }}{{/* not .HasChildren (subsubmenu) */}}
|
||||
<li class='{{- if $active }} active{{ end -}}'>
|
||||
<a href="{{ .URL | relLangURL }}">
|
||||
{{ .Pre }}<span>{{ .Name }}</span>{{ .Post }}
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</details>
|
||||
{{ end }}{{/* range .Children */}}
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ else }}
|
||||
<li
|
||||
class='{{- if $active }} active{{ end -}}'>
|
||||
<li class='{{- if $active }} active{{ end -}}'>
|
||||
<a href="{{ .URL | relLangURL }}">
|
||||
{{ .Pre }}
|
||||
<span>{{ .Name }}</span>
|
||||
{{ .Post }}
|
||||
{{ .Pre }}<span>{{ .Name }}</span>{{ .Post }}
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
</li>
|
||||
{{ else }}
|
||||
<li
|
||||
class='{{- if $active }} active{{ end -}}'>
|
||||
<a href="{{ .URL | relLangURL }}">
|
||||
{{ .Pre }}
|
||||
<span>{{ .Name }}</span>
|
||||
{{ .Post }}
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</details>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue