« get me outta code hell

content: listRandomPageLinks: show skip to section - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/listRandomPageLinks.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-11-09 16:40:18 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-11-09 16:40:18 -0400
commitf6a0bf1d7b4652a7dd04ed3340010ee2a6e47b7f (patch)
tree3ccfa46027b1dd3536e2b020943999767e46b7ab /src/content/dependencies/listRandomPageLinks.js
parent082f693274a62c9f826fd84def417f243c21d612 (diff)
content: listRandomPageLinks: show skip to section
Diffstat (limited to 'src/content/dependencies/listRandomPageLinks.js')
-rw-r--r--src/content/dependencies/listRandomPageLinks.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/content/dependencies/listRandomPageLinks.js b/src/content/dependencies/listRandomPageLinks.js
index 089289f..375a72d 100644
--- a/src/content/dependencies/listRandomPageLinks.js
+++ b/src/content/dependencies/listRandomPageLinks.js
@@ -61,7 +61,19 @@ export default {
     return relations;
   },
 
-  generate(relations, {html, language}) {
+  data(query) {
+    const data = {};
+
+    if (query.divideByGroups) {
+      data.groupDirectories =
+        query.groups
+          .map(group => group.directory);
+    }
+
+    return data;
+  },
+
+  generate(data, relations, {html, language}) {
     const miscellaneousChunkRows = [
       {
         stringsKey: 'randomArtist',
@@ -111,6 +123,13 @@ export default {
           language.$('listingPage.other.randomPages.dataLoadedLine')),
       ],
 
+      showSkipToSection: true,
+
+      chunkIDs: [
+        null,
+        ...data.groupDirectories,
+      ],
+
       chunkTitles: [
         {stringsKey: 'misc'},