« 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/transformContent.js22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/content/dependencies/transformContent.js b/src/content/dependencies/transformContent.js
index eed00882..9a135eef 100644
--- a/src/content/dependencies/transformContent.js
+++ b/src/content/dependencies/transformContent.js
@@ -370,16 +370,18 @@ export default {
 
             const {link, label, hash, toIndex} = linkNode;
 
-            return {
-              type: 'link',
-              data:
-                (toIndex
-                  ? link.slots({content: label, hash})
-                  : link.slots({
-                      content: label, hash,
-                      preferShortName: slots.preferShortLinkNames,
-                    })),
-            };
+            // These are removed from the typical combined slots({})-style
+            // because we don't want to override slots that were already set
+            // by something that's wrapping the linkTemplate or linkThing
+            // template.
+            if (label) link.setSlot('content', label);
+            if (hash) link.setSlot('hash', hash);
+
+            if (toIndex) {
+              link.setSlot('preferShortName', slots.preferShortLinkNames);
+            }
+
+            return {type: 'link', data: link};
           }
 
           case 'tag': {