diff options
| author | Aditya Telange <21258296+adityatelange@users.noreply.github.com> | 2020-10-22 20:39:45 +0530 |
|---|---|---|
| committer | Aditya Telange <21258296+adityatelange@users.noreply.github.com> | 2020-10-22 20:40:00 +0530 |
| commit | 16213a37e5e6748e0951e0547402996317238856 (patch) | |
| tree | 0bfd9347461ae0535b68967896653ac5a0c307ce | |
| parent | 684cb2160fc84a75e17c5d423c000dc94487839e (diff) | |
post-meta: improvements
- hide zero date (closes #33)
- fix separator
- refactor
| -rw-r--r-- | layouts/partials/post_meta.html | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/layouts/partials/post_meta.html b/layouts/partials/post_meta.html index dd3b9a5..479ab89 100644 --- a/layouts/partials/post_meta.html +++ b/layouts/partials/post_meta.html @@ -1,5 +1,11 @@ -<time>{{ .Date.Format (default "January 2, 2006" .Site.Params.DateFormat) }}</time> -{{- if $.Site.Params.ShowReadingTime -}} · -{{- $default_txt := print .ReadingTime " " "min" }} -{{- i18n "read_time" .ReadingTime | default $default_txt }}{{ end }} -{{- if or .Params.author .Site.Params.author }} · {{- .Params.author | default .Site.Params.author }}{{ end }} +{{- if not .Date.IsZero -}} +<time>{{- .Date.Format (default "January 2, 2006" .Site.Params.DateFormat) }}</time> · +{{- end -}} + +{{- if $.Site.Params.ShowReadingTime -}} +{{- i18n "read_time" .ReadingTime | default (printf "%s min" .ReadingTime) }} · +{{- end -}} + +{{- if or .Params.author .Site.Params.author }} +{{- printf "%s" (.Params.author | default .Site.Params.author) }} +{{- end -}} |
