« get me outta code hell

content: linkTemplate: display message when content missing - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-08-08 20:53:56 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-08-08 20:53:56 -0300
commit063d985d6ac4da4547e335a9c8740a1ec9f21570 (patch)
treec9291ca0bb39238646b573dec47d54772e4878b8 /src
parent31a15f783f915811990cefb90fe1661293c49f3d (diff)
content: linkTemplate: display message when content missing
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/linkTemplate.js6
-rw-r--r--src/strings-default.json1
2 files changed, 6 insertions, 1 deletions
diff --git a/src/content/dependencies/linkTemplate.js b/src/content/dependencies/linkTemplate.js
index dab81ad3..2a9261e2 100644
--- a/src/content/dependencies/linkTemplate.js
+++ b/src/content/dependencies/linkTemplate.js
@@ -5,6 +5,7 @@ export default {
     'appendIndexHTML',
     'getColors',
     'html',
+    'language',
     'to',
   ],
 
@@ -23,6 +24,7 @@ export default {
     appendIndexHTML,
     getColors,
     html,
+    language,
     to,
   }) {
     let href = slots.href;
@@ -64,6 +66,8 @@ export default {
         style,
         title,
       },
-      slots.content);
+      (html.isBlank(slots.content)
+        ? language.$('misc.missingLinkContent')
+        : slots.content));
   },
 }
diff --git a/src/strings-default.json b/src/strings-default.json
index ec174a27..7987a9f6 100644
--- a/src/strings-default.json
+++ b/src/strings-default.json
@@ -197,6 +197,7 @@
   "misc.external.flash.homestuck.page": "{LINK} (page {PAGE})",
   "misc.external.flash.homestuck.secret": "{LINK} (secret page)",
   "misc.external.flash.youtube": "{LINK} (on any device)",
+  "misc.missingLinkContent": "(Missing link content)",
   "misc.nav.previous": "Previous",
   "misc.nav.next": "Next",
   "misc.nav.info": "Info",