added variable to define how many articles appear in recent

This commit is contained in:
Nuno Coração
2022-09-19 22:02:42 +01:00
parent 10f0e14d1e
commit bc9911a408
10 changed files with 21 additions and 15 deletions

View File

@@ -1,6 +1,10 @@
{{ $recentArticles := 5 }}
{{ if .Site.Params.homepage.showRecent | default false }}
{{ if index .Site.Params.homepage "showRecentItems" }}
{{ $recentArticles = .Site.Params.homepage.showRecentItems }}
{{ end }}
<h2 class="mt-8 text-2xl font-extrabold mb-10">{{ i18n "shortcode.recent_articles" | emojify }}</h2>
{{ range first 5 (.Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections)).Pages }}
{{ range first $recentArticles (.Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections)).Pages }}
{{ partial "article-link.html" . }}
{{ end }}
{{ end }}