compose-theme/layouts/partials/sidebar.html
2024-07-26 17:08:59 +02:00

30 lines
1.3 KiB
HTML

<aside class="aside menu">
<div>
<label class="aside_toggle toggle" title='{{ T "docs_menu" }}' role="button">{{ T "docs_menu" }} {{ partial "sprite" (dict "icon" "carly") }}</label>
</div>
{{- template "tree" (dict "page" . "section" .FirstSection) }}
{{- define "tree" }}
{{- $section := .section }}
{{- $page := .page }}
{{- $permalink := $page.RelPermalink }}
<section class="section aside_inner">
<h2 class="section_title{{ if eq $section.RelPermalink $permalink }} active{{ end }}"><a href="{{ $section.Permalink }}" class="group">{{ $section.Title }}</a></h2>
{{- $pages := $section.Pages }}
{{- with $pages }}
<section class="" id="docs-{{ anchorize $section.Title }}">
{{- range . }}
{{- if .IsPage }}
<h3 class="section_link{{ if eq .RelPermalink $permalink }} active{{ end }}"><a id="docs-{{ anchorize .Title }}" href="{{ .Permalink }}">{{ .Title }}</a></h3>
{{ $toc_id := printf "toc-%s" (replace (urlize .Title) "." "-") }}
{{- if ne (print .TableOfContents) ""}}
{{- safeHTML (replace .TableOfContents "TableOfContents" $toc_id) }}
{{- end }}
{{- else }}
{{- template "tree" (dict "page" $page "section" .) }}
{{- end }}
{{- end }}
</section>
{{- end }}
</section>
{{- end }}
</aside>