-
|
I want to sort posts by lastmod. So I modify layouts/index.html to: But it doesn't work. Anyone know what's wrong with than? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
{{ define "main" }}
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
- {{ $filtered := ($pages | intersect $notHidden).ByLastmod.Reverse }}
+ {{ $filtered := ($pages | intersect $notHidden) }}
- <pre>{{ jsonify (dict "indent" " ") $filtered }}</pre>
{{ $pag := .Paginate ($filtered) }}
<section class="article-list">
- {{ range $index, $element := $pag.Pages }}
+ {{ range $index, $element := $pag.Pages.ByLastmod.Reverse }}
{{ partial "article-list/default" . }}
{{ end }}
</section>
{{- partial "pagination.html" . -}}
{{- partial "footer/footer" . -}}
{{ end }}
{{ define "right-sidebar" }}
{{ partial "sidebar/right.html" (dict "Context" . "Scope" "homepage") }}
{{ end }} |
Beta Was this translation helpful? Give feedback.
-
|
You're on the right path, but the file you're modifying is not the correct one. In order to display |
Beta Was this translation helpful? Give feedback.
You're on the right path, but the file you're modifying is not the correct one. In order to display
page xin the title, the initial.paginatorwas created inpartials/data/title.html.https://github.com/CaiJimmy/hugo-theme-stack/blob/43e074364ca4bf55c175f994e32725123f3ec953/layouts/partials/data/title.html#L8C1-L11C40