AutorÃa | Ultima modificación | Ver Log |
{{$currentNode := .}}
<nav id="docssidebar" class="collapse d-md-block docs-sidebar" aria-label="Component Library Navigation">
<ul>
{{- if eq .Site.Params.ordersectionsby "title" -}}
{{- range .Site.Home.Sections.ByTitle -}}
{{template "docs-sidebar" dict "sect" . "currentnode" $currentNode}}
{{- end -}}
{{- else -}}
{{- range .Site.Home.Sections.ByWeight -}}
{{template "docs-sidebar" dict "sect" . "currentnode" $currentNode}}
{{- end -}}
{{- end}}
</ul>
</nav>
{{define "docs-sidebar"}}
{{- $currentNode := .currentnode -}}
{{ with .sect }}
{{ if .IsSection }}
{{ if in .Site.Params.menu_exclusion .Section }}
{{- else -}}
{{- safeHTML .Params.head -}}
{{- $numberOfPages := (add (len .Pages) (len .Sections)) -}}
<li class="{{ if .IsAncestor $currentNode }}parent{{ end }}{{ if and .File $currentNode.File }}{{ if eq .File.UniqueID $currentNode.File.UniqueID }} active{{ end }}{{ end }}{{ if .Params.alwaysopen }} parent{{ end }}"><a href="{{ if .IsPage }}{{ .Permalink }}{{ else}}#{{ end }}" data-toggle="collapse" data-target="#collapse{{ .File.UniqueID }}" aria-expanded="true" aria-controls="collapse{{ .File.UniqueID }}" class="dropdown-toggle"><div class="text-truncate">{{ safeHTML .Params.Pre }}{{ .Title }}{{ safeHTML .Params.Post }}</div></a>
{{ if ne $numberOfPages 0 }}
<ul id="collapse{{ .File.UniqueID }}" class="sub-menu collapse {{ if .IsAncestor $currentNode }}show{{ end }}">
{{- .Scratch.Set "pages" .Pages -}}
{{- if .Sections -}}
{{- .Scratch.Set "pages" (.Pages | union .Sections) -}}
{{- end -}}
{{- $pages := (.Scratch.Get "pages") -}}
{{- if eq .Site.Params.ordersectionsby "title" -}}
{{- range $pages.ByTitle -}}
{{- if and .Params.hidden (not $.showhidden) -}}
{{- else -}}
{{template "docs-sidebar" dict "sect" . "currentnode" $currentNode}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- range $pages.ByWeight -}}
{{- if and .Params.hidden (not $.showhidden) -}}
{{- else -}}
{{template "docs-sidebar" dict "sect" . "currentnode" $currentNode}}
{{- end -}}
{{- end -}}
{{- end}}
</ul>
{{end}}
</li>
{{- end -}}
{{- else -}}
{{- if not .Params.Hidden -}}
<li class="{{ if and .File $currentNode.File }}{{ if eq .File.UniqueID $currentNode.File.UniqueID }}active{{ end }}{{ end }}"><a href="{{ if .IsPage }}{{ .Permalink }}{{ end }}">{{ safeHTML .Params.Pre }}{{ .Title }}{{ safeHTML .Params.Post }}</a></li>
{{- end -}}
{{ end -}}
{{ end -}}
{{ end }}