mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-27 14:54:05 -06:00
40 lines
1.4 KiB
HTML
40 lines
1.4 KiB
HTML
{{/* inspired by https://github.com/alex-shpak/hugo-book/blob/master/layouts/partials/docs/menu-filetree.html */}}
|
|
{{ $section := default "/" .Site.Params.BookSection }}
|
|
{{ if eq $section "*" }}
|
|
{{ $section = "/" }} {{/* Backward compatibility */}}
|
|
{{ end }}
|
|
|
|
{{ with .Site.GetPage $section }}
|
|
{{ template "folder-children" (dict "Section" . "CurrentPage" $) }}
|
|
{{ end }}
|
|
|
|
{{ define "folder-children" }}{{/* (dict "Section" .Section "CurrentPage" .CurrentPage) */}}
|
|
<ul>
|
|
{{ range (where .Section.Pages "Params.hidden" "ne" true) }}
|
|
{{ if .IsSection }}
|
|
<li class="folder">
|
|
<div class="wrapper">
|
|
<div class="a-wrapper">
|
|
<div class="arrow"></div>
|
|
</div>
|
|
<a href="{{ .Page.RelPermalink }}" class="title">
|
|
{{- partial "title" .Page -}}
|
|
</a>
|
|
</div>
|
|
{{ template "folder-children" (dict "Section" . "CurrentPage" $.CurrentPage) }}
|
|
</li>
|
|
{{ else if and .IsPage }}
|
|
<li>
|
|
{{ template "children-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
|
|
</li>
|
|
{{ end }}
|
|
{{ end }}
|
|
</ul>
|
|
{{ end }}
|
|
|
|
{{ define "children-link" }}{{/* (dict "Page" .Page "CurrentPage" .CurrentPage) */}}
|
|
{{ $current := eq .CurrentPage .Page }}
|
|
<a href="{{ .Page.RelPermalink }}" class="page-link">
|
|
{{- partial "title" .Page -}}
|
|
</a>
|
|
{{ end }} |