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.

111 lines
4.4 KiB
HTML

{{ $page := . }}
{{ $authors := partial "paige/func-authors.html" $page | and ($page.Parent.Param "paige.subpages.disable_authors" | not) }}
{{ $categories := $page.GetTerms "categories" }}
{{ $date := $page.PublishDate | and ($page.Parent.Param "paige.subpages.disable_date" | not) }}
{{ $description := $page.Description | markdownify | plainify | htmlUnescape | and ($page.Parent.Param "paige.subpages.disable_description" | not) }}
{{ $draft := $page.Draft }}
{{ $expired := and $page.ExpiryDate (lt $page.ExpiryDate now) }}
{{ $flags := slice }}
{{ $format := $page.Parent.Param "paige.date_format" | default ":date_long" }}
{{ $future := and $page.PublishDate (gt $page.PublishDate now) }}
{{ $link := $page.RelPermalink }}
{{ $modified := and $page.PublishDate $page.Lastmod (lt $page.PublishDate $page.Lastmod) }}
{{ $normal := eq ($page.Parent.Param "paige.keyword_style" | default "text") "text" }}
{{ $series := $page.GetTerms "series" | and ($page.Parent.Param "paige.subpages.disable_series" | not) }}
{{ $summary := $page.Summary | markdownify | plainify | htmlUnescape | and ($page.Parent.Param "paige.subpages.disable_summary" | not) }}
{{ $tags := $page.GetTerms "tags" }}
{{ $time := $page.ReadingTime | and ($page.Parent.Param "paige.subpages.disable_reading_time" | not) }}
{{ $title := $page.LinkTitle | markdownify | plainify | htmlUnescape | and ($page.Parent.Param "paige.subpages.disable_title" | not) }}
{{ if $draft }}
{{ $flags = $flags | append "paige-draft" "paige-unpublished" }}
{{ end }}
{{ if $expired }}
{{ $flags = $flags | append "paige-expired" "paige-unpublished" }}
{{ end }}
{{ if $future }}
{{ $flags = $flags | append "paige-future" "paige-unpublished" }}
{{ end }}
{{ if $modified }}
{{ $flags = $flags | append "paige-modified" }}
{{ end }}
{{ if not (or $draft $expired $future) }}
{{ $flags = $flags | append "paige-published" }}
{{ end }}
{{ $class := delimit (slice "paige-page" "w-100" | append $flags | uniq | sort) " " }}
{{ $keywords := sort (append $categories $tags) "LinkTitle" | and ($page.Parent.Param "paige.subpages.disable_keywords" | not) }}
<div class="{{ $class }}">
{{ with $title }}
<p class="paige-row-short paige-title text-center"><a href="{{ $link }}">{{ . }}</a></p>
{{ end }}
{{ with $description }}
<p class="paige-description paige-row-short text-center">{{ . }}</p>
{{ end }}
{{ with $summary }}
<p class="fst-italic paige-row-short paige-summary text-center">{{ . }}</p>
{{ end }}
{{ with $keywords }}
<p class="paige-keywords paige-row-short text-center text-secondary">
{{ range $i, $term := . -}}
{{- $kind := false -}}
{{- if in $categories $term -}}
{{- $kind = "category" -}}
{{- else -}}
{{- $kind = "tag" -}}
{{- end -}}
{{- if $normal -}}
{{- if gt $i 0 }} · {{ end -}}
<a class="link-secondary paige-keyword paige-keyword-{{ $kind }}" href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
{{- else -}}
{{- if gt $i 0 }} {{ end -}}
<a class="badge paige-keyword paige-keyword-{{ $kind }} text-bg-secondary text-decoration-none" href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
{{- end -}}
{{- end }}
</p>
{{ end }}
{{ with $series }}
<p class="paige-row-short paige-series text-center text-secondary">
{{ range $i, $series := . -}}
{{- if gt $i 0 }} · {{ end -}}
<a class="link-secondary" href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
{{- end }}
</p>
{{ end }}
{{ with $authors }}
<p class="paige-authors text-center paige-row-short text-secondary">
{{ range $i, $author := . -}}
{{- if gt $i 0 }} · {{ end -}}
<a class="link-secondary" href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
{{- end }}
</p>
{{ end }}
{{ with $date }}
<p class="paige-date text-center paige-row-short text-secondary">
<time datetime="{{ .Format `2006-01-02` }}">{{ time.Format $format . }}</time>
</p>
{{ end }}
{{ with $time }}
<p class="paige-reading-time paige-row-short text-center text-secondary">{{ . }} {{ i18n "paige_minutes" . }}</p>
{{ end }}
</div>