post-meta: fix redundant '·'(separator) in end

when author is not present
This commit is contained in:
Aditya Telange 2020-10-25 11:17:54 +05:30
parent db0e744af3
commit 3e84ff0435
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77

View File

@ -1,11 +1,17 @@
{{- $scratch := newScratch}}
{{- if not .Date.IsZero -}} {{- if not .Date.IsZero -}}
<time>{{- .Date.Format (default "January 2, 2006" .Site.Params.DateFormat) }}</time>&nbsp;·&nbsp; {{- $scratch.Add "meta" (slice (.Date.Format (default "January 2, 2006" .Site.Params.DateFormat))) }}
{{- end -}} {{- end -}}
{{- if $.Site.Params.ShowReadingTime -}} {{- if $.Site.Params.ShowReadingTime -}}
{{- i18n "read_time" .ReadingTime | default (printf "%s min" .ReadingTime) }}&nbsp;·&nbsp; {{- $scratch.Add "meta" (slice (i18n "read_time" .ReadingTime | default (printf "%s min" .ReadingTime))) }}
{{- end -}} {{- end -}}
{{- if or .Params.author .Site.Params.author }} {{- if or .Params.author .Site.Params.author }}
{{- printf "%s" (.Params.author | default .Site.Params.author) }} {{- $scratch.Add "meta" (slice (.Params.author | default .Site.Params.author)) }}
{{- end -}} {{- end -}}
{{- with ($scratch.Get "meta")}}
{{- delimit . "&nbsp;·&nbsp;"}}
{{- end }}