You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
4.6 KiB
HTML

{{ $page := . }}
{{ if $page.Pages }}
{{ if $page.Params.paige.show_full_pages }}
{{ $p := $page.Paginate $page.Pages }}
<section>
{{ range $p.Pages }}
{{ $page.Scratch.Set "paige_show_full_pages" true }}
{{ partial "paige/article.html" $page }}
{{ end }}
</section>
{{ if or $p.HasPrev $p.HasNext }}
<section>
<div class="d-flex justify-content-center">
{{ partial "paige/pagination.html" $page }}
</div>
</section>
{{ end }}
{{ else }}
{{ $p := $page.Paginate ($page.Pages.ByDate.Reverse.GroupByDate "January 2006") }}
<section>
{{ range $p.PageGroups }}
{{ if $page.Param "paige.page_list.date_header.hide" | not }}
<h2 class="{{ $.Param `paige.page_list.date_header.class` | default `h5 text-center` }}">{{ .Key }}</h2>
{{ end }}
{{ range .Pages }}
{{ $class := "text-center" }}
{{ $authors := cond ($page.Param "paige.page_list.authors.show" | not) "" (partial "paige/func-authors.html" .) }}
{{ $authorsclass := $page.Param "paige.page_list.authors.class" | default (print $class " text-secondary") }}
{{ $date := cond ($page.Param "paige.page_list.date.show" | not) "" .PublishDate }}
{{ $dateclass := $page.Param "paige.page_list.date.class" | default (print $class " text-secondary") }}
{{ $description := cond ($page.Param "paige.page_list.description.hide" | not) (.Description | markdownify) "" }}
{{ $descriptionclass := $page.Param "paige.page_list.description.class" | default $class }}
{{ $flags := slice }}
{{ $gap := "mb-0" }}
{{ $summary := cond ($page.Param "paige.page_list.summary.show" | not) "" (.Summary | strings.TrimPrefix "<p>" | strings.TrimSuffix "</p>") }}
{{ $summaryclass := $page.Param "paige.page_list.summary.class" | default $class }}
{{ $title := cond ($page.Param "paige.page_list.title.hide" | not) (.Title | markdownify) "" }}
{{ $titleclass := $page.Param "paige.page_list.title.class" | default $class }}
{{ if .Draft }}
{{ $flags = $flags | append "paige-draft" "paige-unpublished" }}
{{ end }}
{{ if and .ExpiryDate (lt .ExpiryDate now) }}
{{ $flags = $flags | append "paige-expired" "paige-unpublished" }}
{{ end }}
{{ if and .PublishDate (gt .PublishDate now) }}
{{ $flags = $flags | append "paige-future" "paige-unpublished" }}
{{ end }}
{{ if and .PublishDate .Lastmod (lt .PublishDate .Lastmod) }}
{{ $flags = $flags | append "paige-modified" }}
{{ end }}
{{ $flags = delimit ($flags | sort | uniq) " " }}
<p class="{{ if or $description $authors $date $summary }} {{ $gap }} {{ end }} {{ with $flags }} {{ . }} {{ end }} {{ $titleclass }}">
<a href="{{ .RelPermalink }}">{{ $title | markdownify }}</a>
</p>
{{ with $description }}
<p class="{{ if or $authors $date $summary }} {{ $gap }} {{ end }} {{ $descriptionclass }}">{{ . }}</p>
{{ end }}
{{ with $authors }}
<p class="{{ if or $date $summary }} {{ $gap }} {{ end }} {{ $authorsclass }}">{{ . }}</p>
{{ end }}
{{ if $date }}
<p class="{{ if $summary }} {{ $gap }} {{ end }} {{ $dateclass }}">
<time datetime="{{ $date.Format `2006-01-02` }}">{{ time.Format (.Param "paige.page_list.date.format" | default ":date_long") $date }}</time>
</p>
{{ end }}
{{ if $summary }}
<p class="{{ $summaryclass }}">{{ $summary }}</p>
{{ end }}
{{ end }}
{{ end }}
</section>
{{ if or $p.HasPrev $p.HasNext }}
<section>
<div class="d-flex justify-content-center">
{{ partial "paige/pagination.html" $page }}
</div>
</section>
{{ end }}
{{ end }}
{{ end }}