zola
zola copied to clipboard
permalink sort order wrong?
Bug Report
A long article might be split into multiple parts, each with same create_time and different permalink. The primary sort_by is create_time.
e.g.
- "2022-08-23", "/archives/some-topic-01"
- "2022-08-24", "/archives/some-topic-02"
- "2022-08-24", "/archives/some-topic-03"
the sort results dont match the sort order with create_time (asc vs desc).
Environment
Zola version: 0.15.3
Expected Behavior
- "/archives/some-topic-03"
- "/archives/some-topic-02"
- "/archives/some-topic-01"
Current Behavior
- "/archives/some-topic-02"
- "/archives/some-topic-03"
- "/archives/some-topic-01"
How about change a.permalink.cmp(&b.permalink)
to b.permalink.cmp(&a.permalink)
?
https://github.com/getzola/zola/blob/7f4060b82a6cdb497363392c5a8be17c9f1007ba/components/content/src/sorting.rs#L22-L43
Pardon my ignorance in not fully understanding but wouldn't that just invert the problem?
Pardon my ignorance in not fully understanding but wouldn't that just invert the problem?
Hmmm, I find a workaround. Just set a RFC3339 date variable like '2022-08-24T12:00:00+08:00' in FrontMatter to overrides the date in filename. Then articles at the same day will be sorted with accurate second.
Although I still think it's better to make permalink sorting direction same with the date variable. If these articles are not related, it doesn't matter how they are sorted. But if related, adjusting the permalink sorting rule can be useful for those who manage article dates by filename.