From 00e933a0c0a6d85459576e7536f586b07cb51377 Mon Sep 17 00:00:00 2001
From: "(quasar) nebula" <qznebula@protonmail.com>
Date: Thu, 20 Jun 2024 08:28:06 -0300
Subject: content: generateGroupInfoPageAlbumsSection: match gallery sort

---
 src/content/dependencies/generateGroupInfoPageAlbumsSection.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

(limited to 'src/content/dependencies')

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
-- 
cgit 1.3.0-6-gf8a5