| {{/* |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| */}} |
| |
| {{/* We cache this partial for bigger sites and set the active class client side. */}} |
| <div id="td-sidebar-menu" class="td-sidebar__inner"> |
| <nav class="collapse show td-sidebar-nav pt-2 pl-4" id="td-section-nav"> |
| {{ $rootPage := . }} |
| {{ $firstSection := .FirstSection }} |
| {{ $pages := where (union $firstSection.Pages $firstSection.Sections).ByWeight ".Params.toc_hide" "!=" true }} |
| {{ $pages := $pages | first 50 }} |
| {{ $url := .Permalink}} |
| {{ range $pages }} |
| {{ if .IsPage }} |
| {{ $mid := printf "m-%s" (.RelPermalink | anchorize) }} |
| {{ $active := eq .Permalink $url }} |
| <a class="td-sidebar-link td-sidebar-link__page {{ if $active }} active{{ end }}" |
| id="{{ $mid }}" href="{{ .RelPermalink }}">{{ .LinkTitle }}</a> |
| {{ else }} |
| {{ template "section-tree-nav-section" (dict "page" $rootPage "section" .) }} |
| {{ end }} |
| {{ end }} |
| </nav> |
| </div> |
| {{ define "section-tree-nav-section" }} |
| {{ $s := .section }} |
| {{ $p := .page }} |
| {{ $currentSection := eq $p.CurrentSection $s }} |
| {{ $active := eq $p.Permalink $s.Permalink }} |
| {{ $show := or (and (not $p.Site.Params.ui.sidebar_menu_compact) ($p.IsAncestor $s)) ($p.IsDescendant $s) }} |
| {{ $sid := $s.RelPermalink | anchorize }} |
| <ul class="td-sidebar-nav__section{{ if $currentSection }} current-section{{ end }}"> |
| <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">{{ $s.LinkTitle }}</a> |
| </li> |
| <ul> |
| <li class="{{ if $show }}show{{ end }}" id="{{ $sid }}"> |
| {{ $pages := where (union $s.Pages $s.Sections).ByWeight ".Params.toc_hide" "!=" true }} |
| {{ $pages := $pages | first 50 }} |
| {{ range $pages }} |
| {{ if .IsPage }} |
| {{ $mid := printf "m-%s" (.RelPermalink | anchorize) }} |
| {{ $active := eq . $p }} |
| <a class="td-sidebar-link td-sidebar-link__page {{ if $active }} active{{ end }}" |
| id="{{ $mid }}" href="{{ .RelPermalink }}">{{ .LinkTitle }}</a> |
| {{ else }} |
| {{ template "section-tree-nav-section" (dict "page" $p "section" .) }} |
| {{ end }} |
| {{ end }} |
| </li> |
| </ul> |
| </ul> |
| {{ end }} |