Add page reading time
This commit is contained in:
@@ -274,6 +274,9 @@ paige:
|
||||
description:
|
||||
class: "lead text-center" # Default is "lead text-center"
|
||||
hide: false # Default is false
|
||||
reading_time:
|
||||
class: "text-center text-secondary" # Default is "text-center text-secondary"
|
||||
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
|
||||
@@ -291,6 +294,9 @@ paige:
|
||||
description:
|
||||
class: "text-center" # Default is "text-center"
|
||||
hide: false # Default is false
|
||||
reading_time:
|
||||
class: "text-center text-secondary" # Default is "text-center text-secondary"
|
||||
show: false # Default is false
|
||||
summary:
|
||||
class: "text-center" # Default is "text-center"
|
||||
show: false # Default is false
|
||||
|
@@ -1,6 +1,10 @@
|
||||
paige_figure:
|
||||
other: Figure
|
||||
|
||||
paige_minutes:
|
||||
one: minute
|
||||
other: minutes
|
||||
|
||||
paige_noscript:
|
||||
other: JavaScript is required.
|
||||
|
||||
|
@@ -5,12 +5,17 @@
|
||||
{{ $gap := "mb-0" }}
|
||||
{{ $date := cond ($page.Param "paige.page.date.hide" | not) $page.PublishDate "" }}
|
||||
{{ $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" }}
|
||||
|
||||
{{ with $authors }}
|
||||
<p class="{{ if $date }} {{ $gap }} {{ end }} {{ $authorsclass }}">{{ . }}</p>
|
||||
<p class="{{ if or $date $readingtime }} {{ $gap }} {{ end }} {{ $authorsclass }}">{{ . }}</p>
|
||||
{{ end }}
|
||||
{{ with $date }}
|
||||
<p class="{{ $dateclass }}">
|
||||
<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 }}
|
||||
|
@@ -34,6 +34,8 @@
|
||||
{{ $descriptionclass := $page.Param "paige.page_list.description.class" | default $class }}
|
||||
{{ $flags := slice }}
|
||||
{{ $gap := "mb-0" }}
|
||||
{{ $readingtime := $page.Param "paige.page_list.reading_time.show" }}
|
||||
{{ $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 }}
|
||||
{{ $title := cond ($page.Param "paige.page_list.title.hide" | not) (.Title | markdownify) "" }}
|
||||
@@ -57,20 +59,23 @@
|
||||
|
||||
{{ $flags = delimit ($flags | sort | uniq) " " }}
|
||||
|
||||
<p class="{{ if or $description $authors $date $summary }} {{ $gap }} {{ end }} {{ with $flags }} {{ . }} {{ end }} {{ $titleclass }}">
|
||||
<p class="{{ if or $description $authors $date $readingtime $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>
|
||||
<p class="{{ if or $authors $date $readingtime $summary }} {{ $gap }} {{ end }} {{ $descriptionclass }}">{{ . }}</p>
|
||||
{{ end }}
|
||||
{{ with $authors }}
|
||||
<p class="{{ if or $date $summary }} {{ $gap }} {{ end }} {{ $authorsclass }}">{{ . }}</p>
|
||||
<p class="{{ if or $date $readingtime $summary }} {{ $gap }} {{ end }} {{ $authorsclass }}">{{ . }}</p>
|
||||
{{ end }}
|
||||
{{ if $date }}
|
||||
<p class="{{ if $summary }} {{ $gap }} {{ end }} {{ $dateclass }}">
|
||||
<p class="{{ if or $readingtime $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 $summary }} {{ $gap }} {{ end }} {{ $readingtimeclass }}">{{ .ReadingTime }} {{ i18n "paige_minutes" .ReadingTime }}</p>
|
||||
{{ end }}
|
||||
{{ if $summary }}
|
||||
<p class="{{ $summaryclass }}">{{ $summary }}</p>
|
||||
{{ end }}
|
||||
|
Reference in New Issue
Block a user