Sorting a data file for display

Good morning,

I’m trying to sort a list that was obtained from a bibtex file conversion to yaml (with pandoc-citeproc) based on the year of the publication so that a template I wrote can display the publications properly. At this stage I’m 99% of the way there, expect for the fact that the publications are not sorted. The yml file that pandoc produced has a structure as this one:

---
references:
- id: Ref1
  type: paper-conference
  author:
  - family:  Smith
    given: John
  - family:  Johnson
    given: Joe
  issued: 
  - year: '2010'
    month: July
  title: Some Good Paper Title
   container-title: Name of conference
    page: 10-25
   
- id: Ref2
   ...

You get the idea. The problem is that when the hugo partial reads this, it sees ‘issued’ as a map with two key-value pairs (year and month) and I have not found a way to sort (from the range construction) the record by the year entry in that map. I’ve tried sorting by the ‘whole’ map with no success as in:

{{ range sort .Site.Data.ldm.references "issued" "desc" }}
    ...
{{ end }}

It just ignores the sorting attempt.

Can this be done? How ? Any help or pointer would be greatly appreciated!
Thanks,


Laurent

1 Like

looking for the same. still no official answer.