« get me outta code hell

content: generateGroupInfoPageAlbumsSection: match gallery sort - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateGroupInfoPageAlbumsSection.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-06-20 08:28:06 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-06-20 08:28:06 -0300
commit00e933a0c0a6d85459576e7536f586b07cb51377 (patch)
tree851bf300fc61017726cc1b12131383e744fe2275 /src/content/dependencies/generateGroupInfoPageAlbumsSection.js
parent5049aa139842aaf6e808730a4dc89456acf10fa6 (diff)
content: generateGroupInfoPageAlbumsSection: match gallery sort
Diffstat (limited to 'src/content/dependencies/generateGroupInfoPageAlbumsSection.js')
-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