post-meta: improvements

- hide zero date (closes #33)
- fix separator
- refactor
This commit is contained in:
Aditya Telange 2020-10-22 20:39:45 +05:30
parent 684cb2160f
commit 16213a37e5
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77
1 changed files with 11 additions and 5 deletions

View File

@ -1,5 +1,11 @@
<time>{{ .Date.Format (default "January 2, 2006" .Site.Params.DateFormat) }}</time> {{- if not .Date.IsZero -}}
{{- if $.Site.Params.ShowReadingTime -}}&nbsp;·&nbsp; <time>{{- .Date.Format (default "January 2, 2006" .Site.Params.DateFormat) }}</time>&nbsp;·&nbsp;
{{- $default_txt := print .ReadingTime " " "min" }} {{- end -}}
{{- i18n "read_time" .ReadingTime | default $default_txt }}{{ end }}
{{- if or .Params.author .Site.Params.author }}&nbsp;·&nbsp;{{- .Params.author | default .Site.Params.author }}{{ end }} {{- if $.Site.Params.ShowReadingTime -}}
{{- i18n "read_time" .ReadingTime | default (printf "%s min" .ReadingTime) }}&nbsp;·&nbsp;
{{- end -}}
{{- if or .Params.author .Site.Params.author }}
{{- printf "%s" (.Params.author | default .Site.Params.author) }}
{{- end -}}