docs-v2/layouts/shortcodes/children.html

39 lines
890 B
HTML

{{ $type := .Get "type" | default "articles" }}
{{ $show := .Get "show" | default "all" }}
{{ if eq $show "all" }}
{{ .Scratch.Set "pages" (union .Page.Pages .Page.Sections) }}
{{ else if (eq $show "sections") }}
{{ .Scratch.Set "pages" .Page.Sections }}
{{ else if (eq $show "pages") }}
{{ .Scratch.Set "pages" .Page.Pages }}
{{ end }}
{{ $pages := .Scratch.Get "pages" }}
<div class="children-links">
{{ if eq $type "articles" }}
{{ range $pages.ByWeight }}
<h3><a href="{{ .RelPermalink }}" >{{ .Title }}</a></h3>
<p>
{{- if .Description }}{{- .Description | markdownify -}}
{{ else }}{{- .Summary | markdownify -}}
{{ end -}}
</p>
{{ end }}
{{ else if (eq $type "functions") }}
<ul>
{{ range $pages.ByWeight }}
{{ $title := replaceRE `\ function` "" .Title }}
<li><a href="{{ .RelPermalink }}">{{ $title }}</a></li>
{{ end }}
<ul>
{{ end }}
</div>