From c4232b6e28a9465256ee70a314ccd6659cc00eb1 Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Sat, 14 Dec 2019 13:31:11 +0100 Subject: [PATCH] #113, Hide date from posts if not specified --- layouts/posts/list.html | 6 ++++-- layouts/posts/single.html | 22 ++++++++++++---------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/layouts/posts/list.html b/layouts/posts/list.html index ad941bd..3a3eb97 100644 --- a/layouts/posts/list.html +++ b/layouts/posts/list.html @@ -2,13 +2,15 @@ {{ $dateFormat := default "January 2, 2006" .Site.Params.BookDateFormat }} {{ $paginator := .Paginate (where .Pages "Params.hidden" "ne" true) }} {{ range sort .Paginator.Pages }} -
+

{{ .Title }}

+ {{ with .Date }}
- {{ .Date.Format $dateFormat }} + {{ .Format $dateFormat }}
+ {{ end }}

{{- .Summary -}} {{ if .Truncated }} diff --git a/layouts/posts/single.html b/layouts/posts/single.html index 61c2130..69352cd 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -1,14 +1,16 @@ {{ define "main" }} -{{ $dateFormat := default "January 2, 2006" .Site.Params.BookDateFormat }} -

-

{{ .Title }}

-
- {{ .Date.Format $dateFormat }} -
-
-
- {{- .Content -}} -
+ {{ $dateFormat := default "January 2, 2006" .Site.Params.BookDateFormat }} +
+

{{ .Title }}

+ {{ with .Date }} +
+ {{ .Format $dateFormat }} +
+ {{ end }} +
+
+ {{- .Content -}} +
{{ end }} {{ define "toc" }}