Hi, I have a long page of release notes on my website that I’m grouping by a minorVersion
field in the front matter, currently. The problem is that I need to add a header at some point to denote the release notes that are for versions of the software that are no longer available.
What I’d like to do is:
-
Have one section of my layout that ranges through and groups the release notes and conditionally renders any note with a
minorVersion
of >= 18. -
I’d then like a second section below that one that similarly ranges through the rest of the notes and then conditionally renders them in this second section if the
minorVersion
number is <=17.
How would I do this? I’ve tried nesting where
statements to no avail, and I’ve tried to add the notes for the unavailable versions to a subdirectory and range them there. I’ve not been successful either way.
Here is my code as it stands.
{{ define "main" }}
{{ partial "ia-top-of-page.html" . }}
{{ .Content }}
{{- $image := resources.Get "images/icons/rss.png" | fingerprint -}}
{{ range (.Pages.GroupByParam "minorVersion").Reverse }}
<h2>1.{{ .Key }}.x</h2>
<div class="expandable-content">
<div class="summary">
<div class="svg-wrap"><svg class="svg-Icon" aria-hidden="true"><use xlink:href="#_sprite-plus"></use></svg></div>
<span class="expand-link-text">Version 1.{{ .Key }}.x releases</h2></span>
</div>
<div class="expand-content">
{{ range .Pages }}
<h3>{{ .Title }} ({{ .PublishDate | time.Format ":date_long" }})</h3>
{{ .Content }}
{{- end -}}
</div>
</div>
{{- end -}}
{{ end }}
My front matter looks like this:
---
title: 1.22.7
publishDate: 2022-03-03
minorVersion: 22
---
My directory structure is:
├── content
│ ├── products
│ │ ├── software
│ │ ├── details
│ │ ├── changelog (notes are here)
Any help would be immensely appreciated. Thanks!