I’m having basically the same problem I had 3 years ago. I am trying to sort posts on a field (start date) vs built in
When I set the
sort_field: 'date', it works as you’d expect. When I set it to my custom date field(
sort_field: 'startDate'), the sorting is far more whimsical. I’ve published the problematic site along with debugging info in hopes of getting help (plus it’s low traffic and no one will care but me. )
I have seen this bug report from 2018 but surely whatever the Jekyll sorting issue has been fixed in the intervening 4 years?
The author of that bug opened a new one in the Jekyll repo, and it boiled down to the fact that
Date types can’t be compared. Maybe that will help?:
Error sorting by additional date with timestamp · Issue #6700 · jekyll/jekyll · GitHub
well, all my
Date so you’d think that they could be compared. Just went in and made them all
Times but that didn’t help with sorting accuracy
After talking it out with a friend, we realized that the sorting that I was getting was the exact same sorting as one would get if giving
sort_field: 'fieldThatDoesNotExist'. While changing things around, I managed to trigger a build error that mentioned
sort! in paginationModel.rb. Poking around some more I found a line that indicates that the field name gets downcased (and whitespace stripped out). So, if I change my field name from
startdate it sorts properly.
Therefore, jekyll-paginate-v2 does not sort on fields with names that have capital letters.