Add params for hiding date and reading time per article

pull/2/head
James Panther 2021-08-16 14:05:46 +10:00
parent 5575d2b43e
commit 7ce10997ce
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
2 changed files with 6 additions and 6 deletions

View File

@ -1,16 +1,16 @@
{{ if .Site.Params.article.showDate | default true }} {{ if .Params.showDate | default (.Site.Params.article.showDate | default true) }}
<time datetime="{{ .Date }}"> <time datetime="{{ .Date }}">
{{ .Date.Format .Site.Params.article.dateFormat | default "2 January 2006" }} {{ .Date.Format .Site.Params.article.dateFormat | default "2 January 2006" }}
</time> </time>
{{ end }} {{ end }}
{{ if and {{ if and
(.Site.Params.article.showDate | default true) (.Params.showDate | default (.Site.Params.article.showDate | default true))
(.Site.Params.article.showReadingTime | default true) (.Params.showReadingTime | default (.Site.Params.article.showReadingTime | default true))
(ne .ReadingTime 0) (ne .ReadingTime 0)
}} }}
<span class="px-1">&middot;</span> <span class="px-1">&middot;</span>
{{ end }} {{ end }}
{{ if and (.Site.Params.article.showReadingTime | default true) (ne .ReadingTime 0) }} {{ if and (.Params.showReadingTime | default (.Site.Params.article.showReadingTime | default true)) (ne .ReadingTime 0) }}
<span title="Reading time"> <span title="Reading time">
{{ .ReadingTime }} {{ .ReadingTime }}
min{{ if gt .ReadingTime 1 }}s{{ end }} min{{ if gt .ReadingTime 1 }}s{{ end }}

View File

@ -9,7 +9,7 @@
<span class="mr-3">&larr;</span> <span class="mr-3">&larr;</span>
<span class="flex flex-col"> <span class="flex flex-col">
<span class="button__text">{{ .NextInSection.Title }}</span> <span class="button__text">{{ .NextInSection.Title }}</span>
{{ if .Site.Params.article.showDate | default true }} {{ if .Params.showDate | default (.Site.Params.article.showDate | default true) }}
<time <time
class="-mt-1 text-xs text-gray-400 dark:text-gray-500" class="-mt-1 text-xs text-gray-400 dark:text-gray-500"
datetime="{{ .Date }}" datetime="{{ .Date }}"
@ -26,7 +26,7 @@
<a class="flex text-right" href="{{ .PrevInSection.Permalink }}"> <a class="flex text-right" href="{{ .PrevInSection.Permalink }}">
<span class="flex flex-col"> <span class="flex flex-col">
<span>{{ .PrevInSection.Title }}</span> <span>{{ .PrevInSection.Title }}</span>
{{ if .Site.Params.article.showDate | default true }} {{ if .Params.showDate | default (.Site.Params.article.showDate | default true) }}
<time <time
class="-mt-1 text-xs text-gray-400 dark:text-gray-500" class="-mt-1 text-xs text-gray-400 dark:text-gray-500"
datetime="{{ .Date }}" datetime="{{ .Date }}"