From 25c894d51cf234698bca65481854d59bf1b3e75a Mon Sep 17 00:00:00 2001 From: mntn <85877297+mntn-xyz@users.noreply.github.com> Date: Wed, 4 Aug 2021 22:29:10 -0400 Subject: [PATCH] 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. --- layouts/_default/single.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 1a276fa..16a35f1 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -9,6 +9,11 @@ {{ end }} {{define "aside" }} -

{{ .Params.description }}

-

By {{ .Params.author }}, {{ .Date.Format "2 January 2006" }}

+ {{ if .Params.description }}

{{ .Params.description }}

{{ end }} + {{ if or (.Params.author) (.Params.date) }} +

+ {{ if .Params.author }}By {{ .Params.author }}{{ if .Date }}, {{ end }}{{ end }} + {{ if .Date }}{{ .Date.Format "2 January 2006" }}{{ end }} +

+ {{ end }} {{ end }}