portfolios_exemple2/themes/academia-hugo/layouts/partials/docs_sidebar.html

39 lines
1.6 KiB
HTML
Raw Permalink Normal View History

2021-12-31 12:44:26 +01:00
{{ $current_page := . }}
{{/* Dynamically load menu for this docs page. */}}
{{ $menu_name := path.Base (path.Split .CurrentSection.File).Dir }}
{{ if not (index site.Menus $menu_name) }}
{{ errorf "Please define menu items named `menu: %s:` in your %s front matter or define `[[menu.%s]]` in `config/default/menus.toml`. See https://sourcethemes.com/academic/docs/managing-content/#menus" $menu_name .Path $menu_name }}
{{ end }}
<form class="docs-search d-flex align-items-center">
<button class="btn docs-toggle d-md-none p-0 mr-3" type="button" data-toggle="collapse" data-target="#docs-nav" aria-controls="docs-nav" aria-expanded="false" aria-label="Toggle section navigation">
<span><i class="fas fa-bars"></i></span>
</button>
{{ if eq site.Params.search.engine 1 }}
<input name="q" type="search" class="form-control" id="search-query" placeholder="{{ i18n "search_placeholder" }}" autocomplete="off">
{{ end }}
</form>
<nav class="collapse docs-links" id="docs-nav">
{{ with (index site.Menus $menu_name) }}
{{ range (index site.Menus $menu_name).ByWeight }}
<div class="docs-toc-item{{ if $current_page.IsMenuCurrent $menu_name . }} active{{ end }}">
<a class="docs-toc-link" {{ if .URL }}href="{{ .URL }}"{{else if .HasChildren }}href="{{ (index .Children 0).URL }}"{{end}}>{{ .Name }}</a>
{{- if .HasChildren }}
<ul class="nav docs-sidenav">
{{ range .Children }}
<li {{ if $current_page.IsMenuCurrent $menu_name . }}class="active"{{ end }}>
<a href="{{ .URL }}">{{ .Name }}</a>
</li>
{{ end }}
</ul>
{{ end }}
</div>
{{ end }}
{{ end }}
</nav>