« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generatePreviousNextLinks.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies/generatePreviousNextLinks.js')
-rw-r--r--src/content/dependencies/generatePreviousNextLinks.js25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/content/dependencies/generatePreviousNextLinks.js b/src/content/dependencies/generatePreviousNextLinks.js
index 6cffcef..e3417cb 100644
--- a/src/content/dependencies/generatePreviousNextLinks.js
+++ b/src/content/dependencies/generatePreviousNextLinks.js
@@ -8,25 +8,32 @@ export default {
   slots: {
     previousLink: {type: 'html'},
     nextLink: {type: 'html'},
+    id: {type: 'boolean', default: true},
   },
 
   generate(slots, {html, language}) {
-    return [
-      !html.isBlank(slots.previousLink) &&
+    const previousNext = [];
+
+    if (!html.isBlank(slots.previousLink)) {
+      previousNext.push(
         slots.previousLink.slots({
           tooltip: true,
           color: false,
-          attributes: {id: 'previous-button'},
+          attributes: {id: slots.id && 'previous-button'},
           content: language.$('misc.nav.previous'),
-        }),
+        }));
+    }
 
-      !html.isBlank(slots.nextLink) &&
-        slots.nextLink?.slots({
+    if (!html.isBlank(slots.nextLink)) {
+      previousNext.push(
+        slots.nextLink.slots({
           tooltip: true,
           color: false,
-          attributes: {id: 'next-button'},
+          attributes: {id: slots.id && 'next-button'},
           content: language.$('misc.nav.next'),
-        }),
-    ];
+        }));
+    }
+
+    return previousNext;
   },
 };