I have a JSON array as
{
"Education": [
{
"title": "Bachelor of Technology (B.Tech)",
"current": false,
"where": "Jawaharlal Nehru Technological University, Hyderabad",
"from": 2007,
"to": 2011
},
{
"title": "Postgraduate Diploma in Computer and Information Sciences (PgDipCIS)",
"current": false,
"where": "Auckland University of Technology",
"from": 2013,
"to": 2014
},
{
"title": "Master of Computer and Information Sciences (MCIS) (First Class Honors)",
"current": false,
"where": "Auckland University of Technology",
"from": 2014,
"to": 2015
},
{
"title": "Doctor of Philosophy (PhD)",
"current": true,
"where": "Auckland University of Technology",
"from": 2016,
"to": "Present"
}
]
}
And the way I am displaying it is by doing
{{ range $k, $i := .Site.Data.Education }}
<h2>{{$k}}</h2>
{{ partial "education.html" . }}
{{ end }}
and the education.html
has:
<table class="uk-table uk-table-responsive">
<tbody>
{{ range . }}
<tr>
<td>{{.from}} - {{.to}}</td>
<td>
{{.title}}
<p>{{if .company }}{{.company}},{{end}} {{.where}}</p>
</td>
</tr>
{{ end }}
</tbody>
</table>
How should I reverse the array output such that Doctor of Philosophy (PhD)
is shown first? I tried using reverse
I don’t think it works on maps. I also tried using Scratch
to set the primary index to the length of the array and decrementing it till the last index of the array.
I don’t know what else to do, does Hugo support reversing dictionary arrays?