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.

117 lines
4.9 KiB
HTML

{{ $params := . }}
{{ $fullpages := false }}
{{ $page := . }}
{{ if reflect.IsMap $params }}
{{ $fullpages = $params.fullpages }}
{{ $page = $params.page }}
{{ end }}
{{ $authors := partial "paige/authors.html" $page }}
{{ $categories := $page.Params.categories | default slice | uniq }}
{{ $class := $fullpages }}
{{ $commiturl := "" }}
{{ $date := cond (eq ($page.Param "paige.date.source" | default "published") "published") $page.PublishDate $page.Lastmod }}
{{ $dateformat := $page.Param "paige.date.format" | default ":date_long" }}
{{ $description := $page.Description | markdownify }}
{{ $id := not $fullpages }}
{{ $readingtime := $page.ReadingTime }}
{{ $series := $page.Params.series }}
{{ $tags := $page.Params.tags | default slice | uniq }}
{{ $title := $page.Title | markdownify }}
{{ $titlelink := $page.Params.link }}
{{ $titlepage := $page.RelPermalink }}
{{ if and ($page.Param "paige.git.commit_url_prefix") $page.GitInfo }}
{{ $commiturl = print ($page.Param "paige.git.commit_url_prefix") $page.GitInfo.Hash }}
{{ end }}
<div class="{{ if $class }} paige-metadata {{ end }} w-100" {{ if $id }} id="paige-metadata" {{ end }}>
{{ with $title }}
<h1 class="display-5 fw-bold {{ if $class }} paige-title {{ end }} text-center" {{ if $id }} id="paige-title" {{ end }}>{{ with $titlelink }}<a href="{{ . }}">{{ . }}</a>{{ else }}{{ . }}{{ end }}{{ if $fullpages }}<a aria-label="{{ i18n `paige_aria_page_link` }}" class="paige-header-link" href="{{ $titlepage }}">#</a>{{ end }}</h1>
{{ end }}
{{ with $description }}
<p class="lead {{ if $class }} paige-description {{ end }} text-center" {{ if $id }} id="paige-description" {{ end }}>{{ . }}</p>
{{ end }}
{{ if or $categories $tags }}
<p class="{{ if $class }} paige-keywords {{ end }} text-center" {{ if $id }} id="paige-keywords" {{ end }}>
{{ $terms := slice }}
{{ range $categories }}
{{ $terms = $terms | append (dict "name" . "url" (printf "categories/%v/" . | relLangURL | string)) }}
{{ end }}
{{ range $tags }}
{{ $terms = $terms | append (dict "name" . "url" (printf "tags/%v/" . | relLangURL | string)) }}
{{ end }}
{{ range sort $terms "name" }}
{{ $name := .name }}
{{ with site.GetPage .url }}
{{ $name = .Title }}
{{ end }}
<a class="badge paige-keyword text-bg-secondary text-decoration-none" href="{{ .url | safeURL }}">{{ $name }}</a>
{{ end }}
</p>
{{ end }}
{{ if or $authors $date $readingtime $series }}
<div class="mb-3">
{{ with $series }}
<p class="mb-0 {{ if $class }} paige-series {{ end }} text-center text-secondary" {{ if $id }} id="paige-series" {{ end }}>
{{ range $i, $name := . -}}
{{- if gt $i 0 }}, {{ end -}}
{{- with site.GetPage (print "series/" $name) -}}
<a class="link-secondary" href="{{ .RelPermalink }}">{{ .Title | default $name }}</a>
{{- else -}}
{{- $name -}}
{{- end -}}
{{- end }}
</p>
{{ end }}
{{ with $authors }}
<p class="mb-0 {{ if $class }} paige-authors {{ end }} text-center text-secondary" {{ if $id }} id="paige-authors" {{ end }}>
{{ range $i, $author := . -}}
{{- if gt $i 0 }}, {{ end -}}
{{- with $author.id -}}
{{- with site.GetPage (print "authors/" .) -}}
<a class="link-secondary" href="{{ .RelPermalink }}">{{ .Title | default $author.name }}</a>
{{- else -}}
{{- $author.name -}}
{{- end -}}
{{- else -}}
{{- $author.name -}}
{{- end -}}
{{- end }}
</p>
{{ end }}
{{ with $date }}
<p class="mb-0 {{ if $class }} paige-date {{ end }} text-center text-secondary" {{ if $id }} id="paige-date" {{ end }}>
{{ with $commiturl }}
<a class="link-secondary" href="{{ . }}">
{{ end }}
<time datetime="{{ .Format `2006-01-02` }}">{{ time.Format $dateformat . }}</time>
{{ if $commiturl }}
</a>
{{ end }}
</p>
{{ end }}
{{ with $readingtime }}
<p class="mb-0 {{ if $class }} paige-reading-time {{ end }} text-center text-secondary" {{ if $id }} id="paige-reading-time" {{ end }}>{{ . }} {{ i18n "paige_minutes" . }}</p>
{{ end }}
</div>
{{ end }}
</div>