Hey everyone, I’d like my list page to do different things based on what’s happening. Right now, I have it listing all of my tagged articles, providing the title, description, and other associated tags – that part is great.
However, I’m hoping to leverage the same list page as a release changelog. Is it possible to add a statement that says if .Kind "term" && values contain "releases"
, print the releases in reverse order instead? (most recent first, oldest last). I’m new to templating and not quite sure what that would look like if possible. I know I need to use .Reverse
here after the if statement {{ range .Data.Pages.Reverse }}
. It can be reverse weight or date (I think date would be easier).
Note: “releases” is only one of the tags added to each release.
{{ if eq .Kind "term" }}
<ul style="list-style-type:none;">
{{ range .Data.Pages }}
<li>
<a href="{{.RelPermalink}}"><h2>{{.Title}}</h2></a> <p>{{ .Description}}</p> {{ partial "tags.html" . }}</li>
{{ end }}
</ul>
{{end}}