fix theme sort orderings on list pages

This commit is contained in:
KemoNine 2023-03-23 15:40:22 -04:00
parent 421c7e179e
commit e06f50f004

View file

@ -15,17 +15,20 @@
{{ if not .Params.isBranchWithContent }} {{ if not .Params.isBranchWithContent }}
{{ if not .IsHome }} {{ if not .IsHome }}
<ul> <ul>
{{ $pages := .Pages }} {{ $pages := (sort .Pages ".Title") }}
{{ if (eq .Type "posts") }}
{{ $pages = (sort .Pages ".Date" "desc") }}
{{ end }}
{{ $paginator := .Paginate (where $pages "Section" "!=" "") }} {{ $paginator := .Paginate (where $pages "Section" "!=" "") }}
{{ if (eq .Type "posts") }} {{ if (eq .Type "posts") }}
{{ range sort $paginator.Pages ".Date" "desc"}} {{ range $paginator.Pages }}
<li> <li>
<span class="date">{{ .Date.Format "2006/01/02" }}</span> <span class="date">{{ .Date.Format "2006/01/02" }}</span>
<a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a> <a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a>
</li> </li>
{{ end }} {{ end }}
{{ else }} {{ else }}
{{ range sort $paginator.Pages ".Title" }} {{ range $paginator.Pages }}
<li> <li>
<a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a> <a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a>
</li> </li>