Add page tags

master
Will Faught 2 years ago
parent 98ae0e4658
commit 39ac7d079a

@ -280,6 +280,9 @@ paige:
reading_time:
class: "text-center text-secondary" # Default is "text-center text-secondary"
show: false # Default is false
tags:
class: "badge text-bg-secondary text-decoration-none" # Default is "badge text-bg-secondary text-decoration-none"
show: false # Default is false
title:
class: "display-5 fw-bold text-center" # Default is "display-5 fw-bold text-center"
hide: false # Default is false
@ -306,6 +309,9 @@ paige:
summary:
class: "text-center" # Default is "text-center"
show: false # Default is false
tags:
class: "badge text-bg-secondary text-decoration-none" # Default is "badge text-bg-secondary text-decoration-none"
show: false # Default is false
title:
class: "text-center" # Default is "text-center"
hide: false # Default is false

@ -9,22 +9,31 @@
{{ $dateclass := $page.Param "paige.page.date.class" | default "text-center text-secondary" }}
{{ $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.tags.show" | not) slice ($page.Params.tags | default slice) | sort | uniq }}
{{ $tagsclass := $page.Param "paige.page.tags.class" | default "badge text-bg-secondary text-decoration-none" }}
{{ with $authors }}
<p class="{{ if or $date $readingtime $categories }} {{ $gap }} {{ end }} {{ $authorsclass }}">{{ . }}</p>
<p class="{{ if or $date $readingtime $categories $tags }} {{ $gap }} {{ end }} {{ $authorsclass }}">{{ . }}</p>
{{ end }}
{{ with $date }}
<p class="{{ if or $readingtime $categories }} {{ $gap }} {{ end }} {{ $dateclass }}">
<p class="{{ if or $readingtime $categories $tags }} {{ $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="{{ if $categories }} {{ $gap }} {{ end }} {{ $readingtimeclass }}">{{ $page.ReadingTime }} {{ i18n "paige_minutes" $page.ReadingTime }}</p>
<p class="{{ if or $categories $tags }} {{ $gap }} {{ end }} {{ $readingtimeclass }}">{{ $page.ReadingTime }} {{ i18n "paige_minutes" $page.ReadingTime }}</p>
{{ end }}
{{ with $categories }}
<p class="text-center">
<p class="{{ if $tags }} {{ $gap }} {{ end }} text-center">
{{ range . }}
<a class="{{ $categoriesclass }}" href="{{ relLangURL (printf `categories/%v/` .) | safeURL }}">{{ . }}</a>
{{ end }}
</p>
{{ end }}
{{ with $tags }}
<p class="text-center">
{{ range . }}
<a class="{{ $tagsclass }}" href="{{ relLangURL (printf `tags/%v/` .) | safeURL }}">{{ . }}</a>
{{ end }}
</p>
{{ end }}

@ -40,6 +40,8 @@
{{ $readingtimeclass := $page.Param "paige.page_list.reading_time.class" | default "text-center text-secondary" }}
{{ $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 }}
{{ $tags := cond ($page.Param "paige.page_list.tags.show" | not) slice (.Params.tags | default slice) | sort | uniq }}
{{ $tagsclass := $page.Param "paige.page_list.tags.class" | default "badge text-bg-secondary text-decoration-none" }}
{{ $title := cond ($page.Param "paige.page_list.title.hide" | not) (.Title | markdownify) "" }}
{{ $titleclass := $page.Param "paige.page_list.title.class" | default $class }}
@ -61,30 +63,37 @@
{{ $flags = delimit ($flags | sort | uniq) " " }}
<p class="{{ if or $description $authors $date $readingtime $categories $summary }} {{ $gap }} {{ end }} {{ with $flags }} {{ . }} {{ end }} {{ $titleclass }}">
<p class="{{ if or $description $authors $date $readingtime $categories $tags $summary }} {{ $gap }} {{ end }} {{ with $flags }} {{ . }} {{ end }} {{ $titleclass }}">
<a href="{{ .RelPermalink }}">{{ $title | markdownify }}</a>
</p>
{{ with $description }}
<p class="{{ if or $authors $date $readingtime $categories $summary }} {{ $gap }} {{ end }} {{ $descriptionclass }}">{{ . }}</p>
<p class="{{ if or $authors $date $readingtime $categories $tags $summary }} {{ $gap }} {{ end }} {{ $descriptionclass }}">{{ . }}</p>
{{ end }}
{{ with $authors }}
<p class="{{ if or $date $readingtime $categories $summary }} {{ $gap }} {{ end }} {{ $authorsclass }}">{{ . }}</p>
<p class="{{ if or $date $readingtime $categories $tags $summary }} {{ $gap }} {{ end }} {{ $authorsclass }}">{{ . }}</p>
{{ end }}
{{ if $date }}
<p class="{{ if or $readingtime $categories $summary }} {{ $gap }} {{ end }} {{ $dateclass }}">
<p class="{{ if or $readingtime $categories $tags $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 $readingtime }}
<p class="{{ if or $categories $summary }} {{ $gap }} {{ end }} {{ $readingtimeclass }}">{{ .ReadingTime }} {{ i18n "paige_minutes" .ReadingTime }}</p>
<p class="{{ if or $categories $tags $summary }} {{ $gap }} {{ end }} {{ $readingtimeclass }}">{{ .ReadingTime }} {{ i18n "paige_minutes" .ReadingTime }}</p>
{{ end }}
{{ with $categories }}
<p class="{{ if $summary }} {{ $gap }} {{ end }} text-center">
<p class="{{ if or $tags $summary }} {{ $gap }} {{ end }} text-center">
{{ range . }}
<a class="{{ $categoriesclass }}" href="{{ relLangURL (printf `categories/%v/` .) | safeURL }}">{{ . }}</a>
{{ end }}
</p>
{{ end }}
{{ with $tags }}
<p class="{{ if $summary }} {{ $gap }} {{ end }} text-center">
{{ range . }}
<a class="{{ $tagsclass }}" href="{{ relLangURL (printf `tags/%v/` .) | safeURL }}">{{ . }}</a>
{{ end }}
</p>
{{ end }}
{{ if $summary }}
<p class="{{ $summaryclass }}">{{ $summary }}</p>
{{ end }}

Loading…
Cancel
Save