use current section for listings

This commit is contained in:
Helmut Merz 2020-07-04 17:33:29 +02:00
parent 2337b6264c
commit 7aa47fb7d3
2 changed files with 5 additions and 3 deletions

View file

@ -16,7 +16,8 @@
</div>
<div class="row">
{{ $paginator := .Paginate (where .Site.RegularPages "Section" "posts") }}
{{ $section := or .Section "posts" }}
{{ $paginator := .Paginate (where .Site.RegularPages "Section" $section) }}
{{ range $paginator.Pages }}
{{ partial "card.html" . }}
{{ end }}

View file

@ -33,11 +33,12 @@
<div class="card mt-3">
<div class="card-header">
<h4 class="card-title">{{i18n "recentArticles"}}</h4>
<h4 class="card-text">{{i18n "recentArticles"}}</h4>
</div>
<div class="card-body">
<ul class="list-inline">
{{ range first 3 (where .Site.RegularPages "Section" "posts") }}
{{ $section := or .Section "posts" }}
{{ range first 20 (where .Site.RegularPages "Section" $section) }}
<li>
<a href="{{ .Permalink }}"
class="text-decoration-none">{{ .Title }}</a>