« 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/generateListingPage.js2
-rw-r--r--src/content/dependencies/listRandomPageLinks.js21
2 files changed, 21 insertions, 2 deletions
diff --git a/src/content/dependencies/generateListingPage.js b/src/content/dependencies/generateListingPage.js
index b3d6899d..95c039eb 100644
--- a/src/content/dependencies/generateListingPage.js
+++ b/src/content/dependencies/generateListingPage.js
@@ -96,7 +96,7 @@ export default {
     },
 
     chunkIDs: {
-      validate: v => v.strictArrayOf(v.isString),
+      validate: v => v.strictArrayOf(v.optional(v.isString)),
     },
 
     listStyle: {
diff --git a/src/content/dependencies/listRandomPageLinks.js b/src/content/dependencies/listRandomPageLinks.js
index 089289f7..375a72d7 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'},