« get me outta code hell

content: linkTemplate: handle null href w/ hash cleanly - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-09-05 20:32:13 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-09-05 20:56:07 -0300
commit0ff743b1350b1d42ba23d9701a0b7acfb7501254 (patch)
treea39e7c0cb1ce939a808e325b856d080ab63c8fa4
parentaea700dc531b5183ad20c6fcbf8643aef3f102df (diff)
content: linkTemplate: handle null href w/ hash cleanly
-rw-r--r--src/content/dependencies/linkTemplate.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/content/dependencies/linkTemplate.js b/src/content/dependencies/linkTemplate.js
index 1cf64c5..ba7c7cd 100644
--- a/src/content/dependencies/linkTemplate.js
+++ b/src/content/dependencies/linkTemplate.js
@@ -29,14 +29,16 @@ export default {
     language,
     to,
   }) {
-    let href = slots.href;
+    let href;
     let style;
     let title;
 
-    if (href) {
-      href = encodeURI(href);
+    if (slots.href) {
+      href = encodeURI(slots.href);
     } else if (!empty(slots.path)) {
       href = to(...slots.path);
+    } else {
+      href = '';
     }
 
     if (appendIndexHTML) {