« get me outta code hell

content: linkThing: handle name-undefined things gracefully - 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:
author(quasar) nebula <qznebula@protonmail.com>2023-08-08 20:54:52 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-08-08 20:54:52 -0300
commit08da14a19bd52b759d7844fa45fed12df79ddf75 (patch)
tree0de3267403d0cbdfa03a3105fe02532b0b87886b /src/content/dependencies
parent063d985d6ac4da4547e335a9c8740a1ec9f21570 (diff)
content: linkThing: handle name-undefined things gracefully
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/linkThing.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/content/dependencies/linkThing.js b/src/content/dependencies/linkThing.js
index 4ebf4d76..e3e2608f 100644
--- a/src/content/dependencies/linkThing.js
+++ b/src/content/dependencies/linkThing.js
@@ -44,16 +44,15 @@ export default {
   generate(data, relations, slots, {html}) {
     const path = [data.pathKey, data.directory];
 
-    let content = slots.content;
-
     const name =
       (slots.preferShortName
-        ? data.nameShort ?? data.name
-        : data.name);
+        ? data.nameShort ?? data.name ?? null
+        : data.name ?? null);
 
-    if (html.isBlank(content)) {
-      content = name;
-    }
+    const content =
+      (html.isBlank(slots.content)
+        ? name
+        : slots.content);
 
     let color = null;
     if (slots.color === true) {