« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/content/dependencies/generateGroupInfoPageAlbumsSection.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/content/dependencies/generateGroupInfoPageAlbumsSection.js b/src/content/dependencies/generateGroupInfoPageAlbumsSection.js
index 6a8e0871..a32167fc 100644
--- a/src/content/dependencies/generateGroupInfoPageAlbumsSection.js
+++ b/src/content/dependencies/generateGroupInfoPageAlbumsSection.js
@@ -1,3 +1,4 @@
+import {sortChronologically} from '#sort';
 import {empty, stitchArrays} from '#sugar';
 
 export default {
@@ -13,8 +14,15 @@ export default {
   extraDependencies: ['html', 'language'],
 
   query(group) {
+    // Typically, a latestFirst: false (default) chronological sort would be
+    // appropriate here, but navigation between adjacent albums in a group is a
+    // rather "essential" movement or relationship in the wiki, and we consider
+    // the sorting order of a group's gallery page (latestFirst: true) to be
+    // "canonical" in this regard. We exactly match its sort here, but reverse
+    // it, to still present earlier albums preceding later ones.
     const albums =
-      group.albums;
+      sortChronologically(group.albums.slice(), {latestFirst: true})
+        .reverse();
 
     const albumGroups =
       albums