« 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
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/generateWikiHomePage.js2
-rw-r--r--src/content/dependencies/transformContent.js15
2 files changed, 15 insertions, 2 deletions
diff --git a/src/content/dependencies/generateWikiHomePage.js b/src/content/dependencies/generateWikiHomePage.js
index 666c3f26..d3d05c40 100644
--- a/src/content/dependencies/generateWikiHomePage.js
+++ b/src/content/dependencies/generateWikiHomePage.js
@@ -80,7 +80,7 @@ export default {
             ?.map(content => ({
               html:
                 content.slots({
-                  mode: 'inline',
+                  mode: 'single-link',
                   preferShortLinkNames: true,
                 }),
             }))
diff --git a/src/content/dependencies/transformContent.js b/src/content/dependencies/transformContent.js
index ebb4e12a..03bd7bcc 100644
--- a/src/content/dependencies/transformContent.js
+++ b/src/content/dependencies/transformContent.js
@@ -186,7 +186,7 @@ export default {
 
   slots: {
     mode: {
-      validate: v => v.is('inline', 'multiline', 'lyrics'),
+      validate: v => v.is('inline', 'multiline', 'lyrics', 'single-link'),
       default: 'multiline',
     },
 
@@ -259,6 +259,19 @@ export default {
         return getPlaceholder(node, data.content);
       });
 
+    // In single-link mode, return the link node exactly as is - exposing
+    // access to its slots.
+
+    if (slots.mode === 'single-link') {
+      const link = contentFromNodes.find(node => node.type === 'link');
+
+      if (!link) {
+        return html.blank();
+      }
+
+      return link.data;
+    }
+
     // In inline mode, no further processing is needed!
 
     if (slots.mode === 'inline') {