Hello, I have some version values in my config.tml. These are either x.y or saas. There can be any number of x.y values. What I want is to obtain the latest x.y and use this in my saas pages. Here is an example.
{{- range $key, $value := sort .Site.Params.menus "semver" "desc" -}}
{{- if eq $key 1 -}}
{{ printf "release-%s" .semver }}
{{- end -}}
{{- end -}}
Site.Params.menus is an array of maps. I want to sort it by the semver value. This value may or may not be present. Unfortunately, the sort does not work in a predictable manner. I include this shortcode in three places in a single page. I am getting a different sort at times, so that I cannot consistently select the correct value. Is this perhaps a known issue? We are on Hugo 59.1.
At first glance it seems that you are calling a non-existent parameter with the range and sort functions since you have .Site.Params.menus.1_0 and .Site.Params.menus.1_1 but apparently no .Site.Params.menus is present in the provided code block.
However this is not the way of asking for help in this forum.
Especially when making bold statements about sort not working consistently.
You need to provide a repo for users to see the project in question.
OK, I realize this claim may be bold, however, it is reproducible. Our repo is private, however, I have a partial copy of it here https://github.com/emanic/material-docs I have reproduced this behavior in the dummy repo. You may need to rebuild the site and refresh your browser to observe the behavior of the sort: it is highly variable.