From 6746342f2dafb0800777eabb21bbd2507c14dd74 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Fri, 21 Sep 2018 00:08:25 +0100 Subject: [PATCH] posts: Make using content template (e.g. hugo new) optional --- layouts/partials/widgets/posts.html | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/layouts/partials/widgets/posts.html b/layouts/partials/widgets/posts.html index 187195a3..6e7de960 100644 --- a/layouts/partials/widgets/posts.html +++ b/layouts/partials/widgets/posts.html @@ -31,10 +31,11 @@ {{ $.Scratch.Set "show_post" "1" }} {{/* If `tags_include` is set, exclude posts with no tags. */}} - {{ if and ($page.Params.tags_include) (lt (len .Params.tags) 1) }} - {{ $.Scratch.Set "show_post" "0" }} + {{ with (not .Params.tags) }} + {{ with $page.Params.tags_include }} + {{ $.Scratch.Set "show_post" "0" }} + {{end}} {{end}} - {{/* If `tags_exclude` is set, exclude posts. */}} {{ range $key, $val := .Params.tags }} {{ if in $page.Params.tags_exclude $val }} @@ -62,8 +63,10 @@ {{ $.Scratch.Set "show_post" "1" }} {{/* If `tags_include` is set, exclude posts with no tags. */}} - {{ if and ($page.Params.tags_include) (lt (len .Params.tags) 1) }} - {{ $.Scratch.Set "show_post" "0" }} + {{ with (not .Params.tags) }} + {{ with $page.Params.tags_include }} + {{ $.Scratch.Set "show_post" "0" }} + {{end}} {{end}} {{/* If `tags_exclude` is set, exclude posts. */}}