diff options
author | frosty <passedgoandgot200@disroot.org> | 2025-05-19 08:52:49 -0400 |
---|---|---|
committer | frosty <passedgoandgot200@disroot.org> | 2025-05-19 08:52:49 -0400 |
commit | f8cc991b774ccd1bf99d05c44ba96eb3e46cbd83 (patch) | |
tree | 72b2de4ceae30a84dc7723331d1682d5ccfcaea2 | |
parent | ce8a79066992da40d72ec4164e80a83966631cc1 (diff) |
use 'with' to handle missing dates
-rw-r--r-- | themes/polaris/layouts/_default/now.html | 10 | ||||
-rw-r--r-- | themes/polaris/layouts/_default/single.html | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/themes/polaris/layouts/_default/now.html b/themes/polaris/layouts/_default/now.html index bb77eaf..5bd01c0 100644 --- a/themes/polaris/layouts/_default/now.html +++ b/themes/polaris/layouts/_default/now.html @@ -1,8 +1,8 @@ {{ define "main" }} - <h1>{{ .Title }}</h1> +<h1>{{ .Title }}</h1> {{ .Content }} - <p> - Last updated {{ .Date | time.Format "Jan 02 2006" }}. - <a href="https://nownownow.com/about">What the heck is a “now page”?</a> - </p> +<p> + {{ with .Date }}Last updated {{ . | time.Format "Jan 02 2006" }}.{{ end }} + <a href="https://nownownow.com/about">What the heck is a “now page”?</a> +</p> {{ end }} diff --git a/themes/polaris/layouts/_default/single.html b/themes/polaris/layouts/_default/single.html index d87f112..ef44984 100644 --- a/themes/polaris/layouts/_default/single.html +++ b/themes/polaris/layouts/_default/single.html @@ -1,5 +1,5 @@ {{ define "main" }} - <h1>{{ .Title }}</h1> - <p><em>Written {{ .Date | time.Format "Jan 02 2006" }}.</em></p> +<h1>{{ .Title }}</h1> + {{ with .Date }}<p><em>Written {{ . | time.Format "Jan 02 2006" }}.</em></p>{{ end }} {{ .Content }} {{ end }} |