Omphaloskepsis-2/layouts/partials/cv/organisations/reverse-slice.html

10 lines
316 B
HTML
Raw Permalink Normal View History

2022-11-11 05:48:02 +00:00
<!-- Source: https://discourse.gohugo.io/t/reverse-array/28753/2 -->
{{- $sliceOriginal := . -}}
{{- $len := len $sliceOriginal -}}
{{- $sliceReversed := slice -}}
{{- range seq $len -}}
{{- $sliceReversed = $sliceReversed | append (index $sliceOriginal (sub $len .)) }}
{{- end -}}
{{- return $sliceReversed -}}