Refactor and overhaul page metadata
parent
6f02b083f9
commit
061baff39e
@ -1,39 +0,0 @@
|
||||
{{ $page := . }}
|
||||
|
||||
{{ $authors := cond ($page.Param "paige.page.authors.hide" | not) (partial "paige/func-authors.html" $page) "" }}
|
||||
{{ $authorsclass := $page.Param "paige.page.authors.class" | default "text-center text-secondary" }}
|
||||
{{ $categories := cond ($page.Param "paige.page.terms.show" | not) slice ($page.Params.categories | default slice) | sort | uniq }}
|
||||
{{ $date := cond ($page.Param "paige.page.date.hide" | not) $page.PublishDate "" }}
|
||||
{{ $dateclass := $page.Param "paige.page.date.class" | default "text-center text-secondary" }}
|
||||
{{ $gap := "mb-0" }}
|
||||
{{ $readingtime := $page.Param "paige.page.reading_time.show" }}
|
||||
{{ $readingtimeclass := $page.Param "paige.page.reading_time.class" | default "text-center text-secondary" }}
|
||||
{{ $tags := cond ($page.Param "paige.page.terms.show" | not) slice ($page.Params.tags | default slice) | sort | uniq }}
|
||||
{{ $termsinnerclass := $page.Param "paige.page.terms.inner_class" | default "badge text-bg-secondary text-decoration-none" }}
|
||||
{{ $termsouterclass := $page.Param "paige.page.terms.outer_class" | default "text-center" }}
|
||||
|
||||
{{ if or $categories $tags }}
|
||||
<p {{ with $termsouterclass }} class="{{ . }}" {{ end }}>
|
||||
{{ $terms := slice }}
|
||||
{{ range $categories }}
|
||||
{{ $terms = $terms | append (dict "name" . "url" (lower . | printf "categories/%v/" | relLangURL)) }}
|
||||
{{ end }}
|
||||
{{ range $tags }}
|
||||
{{ $terms = $terms | append (dict "name" . "url" (lower . | printf "tags/%v/" | relLangURL)) }}
|
||||
{{ end }}
|
||||
{{ range sort $terms "name" }}
|
||||
<a {{ with $termsinnerclass }} class="{{ . }}" {{ end }} href="{{ .url | safeURL }}">{{ .name }}</a>
|
||||
{{ end }}
|
||||
</p>
|
||||
{{ end }}
|
||||
{{ with $authors }}
|
||||
<p class="{{ if or $date $readingtime }} {{ $gap }} {{ end }} {{ $authorsclass }}">{{ . }}</p>
|
||||
{{ end }}
|
||||
{{ with $date }}
|
||||
<p class="{{ if $readingtime }} {{ $gap }} {{ end }} {{ $dateclass }}">
|
||||
<time datetime="{{ .Format `2006-01-02` }}">{{ time.Format ($page.Param "paige.page.date.format" | default ":date_long") . }}</time>
|
||||
</p>
|
||||
{{ end }}
|
||||
{{ if $readingtime }}
|
||||
<p class="{{ $readingtimeclass }}">{{ $page.ReadingTime }} {{ i18n "paige_minutes" $page.ReadingTime }}</p>
|
||||
{{ end }}
|
@ -1,8 +0,0 @@
|
||||
{{ $page := . }}
|
||||
|
||||
{{ $class := $page.Param "paige.page.description.class" | default "lead text-center" }}
|
||||
{{ $description := cond ($page.Param "paige.page.description.hide" | not) ($page.Description | markdownify) "" }}
|
||||
|
||||
{{ with $description }}
|
||||
<p class="{{ $class }}">{{ . }}</p>
|
||||
{{ end }}
|
@ -1,7 +1,63 @@
|
||||
{{ $page := . }}
|
||||
|
||||
<section class="paige-metadata w-100">
|
||||
{{ partial "paige/title.html" $page }}
|
||||
{{ partial "paige/description.html" $page }}
|
||||
{{ partial "paige/about.html" $page }}
|
||||
{{ $authors := cond ($page.Param "paige.page.authors.hide" | not) (partial "paige/func-authors.html" $page) "" }}
|
||||
{{ $authorsclass := $page.Param "paige.page.authors.class" | default "text-center text-secondary" }}
|
||||
{{ $categories := cond ($page.Param "paige.page.terms.show" | not) slice ($page.Params.categories | default slice) | sort | uniq }}
|
||||
{{ $date := cond ($page.Param "paige.page.date.hide" | not) $page.PublishDate "" }}
|
||||
{{ $dateclass := $page.Param "paige.page.date.class" | default "text-center text-secondary" }}
|
||||
{{ $dateformat := $page.Param "paige.page.date.format" | default ":date_long" }}
|
||||
{{ $description := cond ($page.Param "paige.page.description.hide" | not) ($page.Description | markdownify) "" }}
|
||||
{{ $descriptionclass := $page.Param "paige.page.description.class" | default "lead text-center" }}
|
||||
{{ $nogap := "mb-0" }}
|
||||
{{ $readingtime := cond ($page.Param "paige.page.reading_time.show" | not) "" $page.ReadingTime }}
|
||||
{{ $readingtimeclass := $page.Param "paige.page.reading_time.class" | default "text-center text-secondary" }}
|
||||
{{ $sectionclass := "paige-metadata w-100" }}
|
||||
{{ $tags := cond ($page.Param "paige.page.terms.show" | not) slice ($page.Params.tags | default slice) | sort | uniq }}
|
||||
{{ $termsinnerclass := $page.Param "paige.page.terms.inner_class" | default "badge text-bg-secondary text-decoration-none" }}
|
||||
{{ $termsouterclass := $page.Param "paige.page.terms.outer_class" | default "text-center" }}
|
||||
{{ $title := cond ($page.Param "paige.page.title.hide" | not) ($page.Title | markdownify) "" }}
|
||||
{{ $titleclass := $page.Param "paige.page.title.class" | default "display-5 fw-bold text-center" }}
|
||||
{{ $titlelink := $page.Params.link }}
|
||||
{{ $titlepage := $page.RelPermalink }}
|
||||
|
||||
<section {{ with $sectionclass }} class="{{ . }}" {{ end }}>
|
||||
{{ with $title }}
|
||||
<h1 {{ with $titleclass }} class="{{ . }}" {{ end }}>{{ with $titlelink }}<a href="{{ . }}">{{ . }}</a>{{ else }}{{ . }}{{ end }}{{ if $page.Scratch.Get "paige_show_full_pages" }}<a aria-label="Link to this section" class="paige-header-link" href="{{ $titlepage }}">#</a>{{ end }}</h1>
|
||||
{{ end }}
|
||||
|
||||
{{ with $description }}
|
||||
<p {{ with $descriptionclass }} class="{{ . }}" {{ end }}>{{ . }}</p>
|
||||
{{ end }}
|
||||
|
||||
{{ if or $categories $tags }}
|
||||
<p {{ with $termsouterclass }} class="{{ . }}" {{ end }}>
|
||||
{{ $terms := slice }}
|
||||
|
||||
{{ range $categories }}
|
||||
{{ $terms = $terms | append (dict "name" . "url" (lower . | printf "categories/%v/" | relLangURL)) }}
|
||||
{{ end }}
|
||||
|
||||
{{ range $tags }}
|
||||
{{ $terms = $terms | append (dict "name" . "url" (lower . | printf "tags/%v/" | relLangURL)) }}
|
||||
{{ end }}
|
||||
|
||||
{{ range sort $terms "name" }}
|
||||
<a {{ with $termsinnerclass }} class="{{ . }}" {{ end }} href="{{ .url | safeURL }}">{{ .name }}</a>
|
||||
{{ end }}
|
||||
</p>
|
||||
{{ end }}
|
||||
|
||||
{{ with $authors }}
|
||||
<p {{ if or $authorsclass $date $readingtime }} class="{{ if or $date $readingtime }} {{ $nogap }} {{ end }} {{ with $authorsclass }} {{ . }} {{ end }}" {{ end }}>{{ . }}</p>
|
||||
{{ end }}
|
||||
|
||||
{{ with $date }}
|
||||
<p {{ if or $dateclass $readingtime }} class="{{ if $readingtime }} {{ $nogap }} {{ end }} {{ with $dateclass }} {{ . }} {{ end }}" {{ end }}>
|
||||
<time datetime="{{ .Format `2006-01-02` }}">{{ time.Format $dateformat . }}</time>
|
||||
</p>
|
||||
{{ end }}
|
||||
|
||||
{{ with $readingtime }}
|
||||
<p {{ with $readingtimeclass }} class="{{ . }}" {{ end }}>{{ . }} {{ i18n "paige_minutes" . }}</p>
|
||||
{{ end }}
|
||||
</section>
|
||||
|
@ -1,8 +0,0 @@
|
||||
{{ $page := . }}
|
||||
|
||||
{{ $class := $page.Param "paige.page.title.class" | default "display-5 fw-bold text-center" }}
|
||||
{{ $title := cond ($page.Param "paige.page.title.hide" | not) ($page.Title | markdownify) "" }}
|
||||
|
||||
{{ if $title }}
|
||||
<h1 class="{{ $class }}">{{ with $page.Params.link }}<a href="{{ . }}">{{ $title }}</a>{{ else }}{{ $title }}{{ end }}{{ if $page.Scratch.Get "paige_show_full_pages" }}<a aria-label="Link to this section" class="paige-header-link" href="{{ $page.RelPermalink }}">#</a>{{ end }}</h1>
|
||||
{{ end }}
|
Loading…
Reference in New Issue