selfprivacy.org/_vendor/github.com/google/docsy/layouts/partials/section-index.html
2024-04-26 01:15:39 +03:00

34 lines
1.9 KiB
HTML

<div class="section-index">
{{ $parent := .Page -}}
{{ $pages := (where .Site.Pages "Section" .Section).ByWeight -}}
{{ $pages = (where $pages "Type" "!=" "search") }}
{{ $pages = (where $pages ".Params.hide_summary" "!=" true) -}}
{{ $pages = (where $pages ".Parent" "!=" nil) -}}
{{ if and .Parent .Parent.File -}}
{{ $pages = (where $pages "Parent.File.UniqueID" "==" $parent.File.UniqueID) -}}
{{ end -}}
{{ if or $parent.Params.no_list (eq (len $pages) 0) -}}
{{/* If no_list is true or we don't have subpages we don't show a list of subpages */}}
{{ else if $parent.Params.simple_list -}}
{{/* If simple_list is true we show a bulleted list of subpages */}}
<ul>
{{ range $pages -}}
{{ $manualLink := cond (isset .Params "manuallink") .Params.manualLink ( cond (isset .Params "manuallinkrelref") (relref . .Params.manualLinkRelref) .RelPermalink) }}
<li><a href="{{ $manualLink }}"{{ with .Params.manualLinkTitle }} title="{{ . }}"{{ end }}{{ with .Params.manualLinkTarget }} target="{{ . }}"{{ if eq . "_blank" }} rel="noopener"{{ end }}{{ end }}>{{- .Title -}}</a></li>
{{ end -}}
</ul>
{{ else -}}
{{/* Otherwise we show a nice formatted list of subpages with page descriptions */}}
<hr class="panel-line">
{{ range $pages -}}
{{ $manualLink := cond (isset .Params "manuallink") .Params.manualLink ( cond (isset .Params "manuallinkrelref") (relref . .Params.manualLinkRelref) .RelPermalink) -}}
<div class="entry">
<h5>
<a href="{{ $manualLink }}"{{ with .Params.manualLinkTitle }} title="{{ . }}"{{ end }}{{ with .Params.manualLinkTarget }} target="{{ . }}"{{ if eq . "_blank" }} rel="noopener"{{ end }}{{ end }}>{{- .Title -}}</a>
</h5>
<p>{{ .Description | markdownify -}}</p>
</div>
{{ end -}}
{{ end -}}
</div>