From 148859ad5412d2e2bcd69905df66f749e288a4b1 Mon Sep 17 00:00:00 2001 From: donfiguerres Date: Thu, 12 Aug 2021 00:34:04 +0800 Subject: [PATCH] Added default value. --- layouts/partials/sections/recent-posts.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/layouts/partials/sections/recent-posts.html b/layouts/partials/sections/recent-posts.html index 7dbc7e4..9491977 100644 --- a/layouts/partials/sections/recent-posts.html +++ b/layouts/partials/sections/recent-posts.html @@ -3,13 +3,19 @@ {{ $sectionID = .section.id }} {{ end }} +{{ $numShow := 3}} +{{ if .section.numShow }} + {{ $numShow = .section.numShow }} +{{ end }} + +
{{ if not (.section.hideTitle) }}

{{ .section.name }}

{{ end }}
- {{ range first .section.numShow (where site.RegularPages.ByDate.Reverse "Type" "in" "posts" )}} + {{ range first $numShow (where site.RegularPages.ByDate.Reverse "Type" "in" "posts" )}} {{ partial "cards/recent-post.html" . }} {{ end }}