From f9c98de489b4fbeca8d0b98b97747a5c053ac45d Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Tue, 6 Jul 2021 23:17:14 +0200 Subject: [PATCH] added post param to hide date from single post view --- README.md | 1 + layouts/_default/single.html | 10 ++++++---- layouts/partials/article_card.html | 16 ++++++++-------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index d477afe..28c245f 100644 --- a/README.md +++ b/README.md @@ -272,6 +272,7 @@ Every post can have various parameters in the frontmatter, here are some that yo - `tags`: a list of tags for your post - `image`: a link to a feature image for the article, shown in the preview as well - `comments`: boolean, if true it enables comments for the current post, if false it disables them (default is true) +- `showDate`: boolean, true by default, if false hides the date. Useful for non-article pages where the date isn't important # Does *Ficurinia* mean anything? diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 8cb6586..c6bc4b0 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -2,10 +2,12 @@ {{- partial "inject/content-before.html" . -}}

{{ .Title }}

-

- - {{ .Date.Format "2006-01-02" }} -

+ {{ if (.Params.showDate | default true) }} +

+ + {{ .Date.Format "2006-01-02" }} +

+ {{ end }} {{ if .Params.Image }} {{ end }} diff --git a/layouts/partials/article_card.html b/layouts/partials/article_card.html index 637a759..6834193 100644 --- a/layouts/partials/article_card.html +++ b/layouts/partials/article_card.html @@ -4,15 +4,15 @@ {{ .Title }}

- - {{ .Date.Format "2006-01-02" }} - {{ if and (site.Params.tagsInArticlePreview | default true) .Params.tags }} - | - - {{ range sort .Params.tags }} - #{{ . }} + + {{ .Date.Format "2006-01-02" }} + {{ if and (site.Params.tagsInArticlePreview | default true) .Params.tags }} + | + + {{ range sort .Params.tags }} + #{{ . }} + {{ end }} {{ end }} - {{ end }}

{{ if .Site.Params.imageInArticlePreview }} {{ if .Params.Image }}