You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.8 KiB
HTML
65 lines
2.8 KiB
HTML
{{/*
|
|
|
|
A version of the sidebar-tree.html partial in Docsy, with a few small
|
|
modifications:
|
|
|
|
* include `div#toc` for the ToC
|
|
* start the sidebar at the root (homepage) since for us that is the Matrix
|
|
overview page
|
|
* omit module pages, which we don't want to be directly accessible
|
|
(we only use them as raw material for the client-server spec)
|
|
|
|
*/}}
|
|
|
|
{{/* We cache this partial for bigger sites and set the active class client side. */}}
|
|
{{ $shouldDelayActive := ge (len .Site.Pages) 2000 }}
|
|
<div id="td-sidebar-menu" class="td-sidebar__inner{{ if $shouldDelayActive }} d-none{{ end }}">
|
|
<div id="content-mobile">
|
|
<form class="td-sidebar__search d-flex align-items-center">
|
|
{{ partial "search-input.html" . }}
|
|
<button class="btn btn-link td-sidebar__toggle d-md-none p-0 ml-3 fas fa-bars" type="button" data-toggle="collapse" data-target="#td-section-nav" aria-controls="td-docs-nav" aria-expanded="false" aria-label="Toggle section navigation">
|
|
</button>
|
|
</form>
|
|
</div>
|
|
<div id="content-desktop"></div>
|
|
<nav class="collapse td-sidebar-nav" id="td-section-nav">
|
|
{{ template "section-tree-nav-section" (dict "page" . "section" .Site.Home.CurrentSection "delayActive" $shouldDelayActive "indent" 0) }}
|
|
<hr/>
|
|
<div id = "toc"></div>
|
|
</nav>
|
|
</div>
|
|
|
|
{{ define "section-tree-nav-section" }}
|
|
{{ $s := .section }}
|
|
{{ $p := .page }}
|
|
{{ $shouldDelayActive := .delayActive }}
|
|
{{ $indent := .indent }}
|
|
{{ $active := eq $p.RelPermalink $s.RelPermalink }}
|
|
{{ $show := or ($p.IsAncestor $s) ($p.IsDescendant $s) }}
|
|
{{ $sid := $s.RelPermalink | anchorize }}
|
|
<ul class="td-sidebar-nav__section pr-md-3">
|
|
<li class="td-sidebar-nav__section-title">
|
|
<a href="{{ $s.RelPermalink }}" class="align-left pl-0 pr-2{{ if not $show }} collapsed{{ end }}{{ if $active}} active{{ end }} td-sidebar-link td-sidebar-link__section indent-{{$indent}}">{{ $s.LinkTitle }}</a>
|
|
{{ $pages := where (union $s.Pages $s.Sections).ByWeight ".Params.toc_hide" "!=" true }}
|
|
{{ $pages = where $pages "Type" "!=" "module"}}
|
|
{{ $pages := $pages | first 50 }}
|
|
{{ if gt (len $pages) 0 }}
|
|
<ul>
|
|
{{ range $pages }}
|
|
{{ if .IsPage }}
|
|
{{ $mid := printf "m-%s" (.RelPermalink | anchorize) }}
|
|
{{ $active := eq . $p }}
|
|
<li class="collapse {{ if $show }}show{{ end }}" id="{{ $sid }}">
|
|
<a class="td-sidebar-link td-sidebar-link__page {{ if and (not $shouldDelayActive) $active }} active{{ end }} indent-{{add $indent 1}}" id="{{ $mid }}" href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
|
|
</li>
|
|
{{ else }}
|
|
{{ $indent := add $indent 1 }}
|
|
{{ template "section-tree-nav-section" (dict "page" $p "section" . "indent" $indent) }}
|
|
{{ end }}
|
|
{{ end }}
|
|
</ul>
|
|
{{ end }}
|
|
</li>
|
|
</ul>
|
|
{{ end }}
|