hugo-PaperMod/layouts/partials/post_meta.html
Rook1e 1521cc77a2
feat: allow hiding author in post_meta (#1250)
* feat: allow hiding author in post_meta

For a person's site, in most cases the author is the person, and displaying it
on every post and list may be redundant.

Setting the `params.author` in the configuration to empty will achieve
the hidden effect, but it will also empty the value of `<meta name="author">`.

So add hideAuthor
2023-08-05 11:52:30 +05:30

24 lines
749 B
HTML

{{- $scratch := newScratch }}
{{- if not .Date.IsZero -}}
{{- $scratch.Add "meta" (slice (printf "<span title='%s'>%s</span>" (.Date) (.Date | time.Format (default "January 2, 2006" site.Params.DateFormat)))) }}
{{- end }}
{{- if (.Param "ShowReadingTime") -}}
{{- $scratch.Add "meta" (slice (i18n "read_time" .ReadingTime | default (printf "%d min" .ReadingTime))) }}
{{- end }}
{{- if (.Param "ShowWordCount") -}}
{{- $scratch.Add "meta" (slice (i18n "words" .WordCount | default (printf "%d words" .WordCount))) }}
{{- end }}
{{- if not (.Param "hideAuthor") -}}
{{- with (partial "author.html" .) }}
{{- $scratch.Add "meta" (slice .) }}
{{- end }}
{{- end }}
{{- with ($scratch.Get "meta") }}
{{- delimit . "&nbsp;·&nbsp;" -}}
{{- end -}}