Skip to content

Commit

Permalink
List posts and news sorted by date reverse
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmeggle committed Apr 29, 2024
1 parent 4814e2b commit 329e208
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions layouts/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{ define "main" }}
<main class="main list" role="main">
{{- with .Content }}
<div class="content main__content clearfix">
{{ . }}
</div>
{{- end }}
{{/* {{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }} */}}
{{/* SME: order by date reverse */}}
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ $sortedPages := $pages.ByDate.Reverse }}
{{ $paginator := .Paginate $sortedPages }}
{{- range $paginator.Pages }}
{{- .Render "summary" }}
{{- end }}
{{- if and (eq $paginator.TotalNumberOfElements 0) (not $.Content) }}
<div class="warning">
{{ partial "svg/files.svg" (dict "class" "warning__icon") }}
<h3 class="warning__headline">{{ T "noposts_warning_title" | safeHTML }}</h3>
<div class="warning__text">
<p class="warning__description">{{ T "noposts_warning_description" | safeHTML }}</p>
<p class="warning__tip">{{ T "noposts_warning_tip" | safeHTML }}</p>
</div>
</div>
{{ end }}
</main>
{{ partial "pagination.html" . }}
{{ end }}

0 comments on commit 329e208

Please sign in to comment.