Only show aside data if present

People may not always define description, author, and date in their front matter. This change skips adding each field to the aside if it is missing.
This commit is contained in:
mntn 2021-08-04 22:29:10 -04:00 committed by GitHub
parent 1e6ebdbb52
commit 25c894d51c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -9,6 +9,11 @@
{{ end }}
{{define "aside" }}
<p>{{ .Params.description }}</p>
<p>By {{ .Params.author }}, {{ .Date.Format "2 January 2006" }}</p>
{{ if .Params.description }}<p>{{ .Params.description }}</p>{{ end }}
{{ if or (.Params.author) (.Params.date) }}
<p>
{{ if .Params.author }}By {{ .Params.author }}{{ if .Date }}, {{ end }}{{ end }}
{{ if .Date }}{{ .Date.Format "2 January 2006" }}{{ end }}
</p>
{{ end }}
{{ end }}