hugo-theme-termlite/layouts/shortcodes/pages-list.html

34 lines
815 B
HTML
Raw Normal View History

{{- $sectionName := .Get "section" -}}
{{- $limit := .Get "limit" -}}
{{- $style := .Get "style" | default "bullets" -}}
{{- $pagesSource := dict -}}
{{- with $sectionName -}}
{{ with $section := site.GetPage . }}
{{ $pagesSource = $section }}
{{ else }}
{{ errorf "Couldn't get Page for section named '%s'" . }}
{{ end }}
{{ else }}
{{ $pagesSource = site }}
{{- end -}}
{{- $pages := $pagesSource.Pages.ByTitle -}}
{{- with $limit -}}
{{ $pages = $pages.Limit $limit }}
{{- end -}}
{{ with $pages -}}
{{- if eq $style "bullets" }}
<ul>
{{ range $pages -}}
<li><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li>
{{ end }}
</ul>
{{ else if eq $style "summaries" }}
{{ range $pages }}
{{ .Render "page_summary" }}
{{ end }}
{{ end -}}
{{ end }}