« 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/linkExternal.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies/linkExternal.js')
-rw-r--r--src/content/dependencies/linkExternal.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/content/dependencies/linkExternal.js b/src/content/dependencies/linkExternal.js
index 9469a9e..2de1bc7 100644
--- a/src/content/dependencies/linkExternal.js
+++ b/src/content/dependencies/linkExternal.js
@@ -6,6 +6,11 @@ export default {
   data: (url) => ({url}),
 
   slots: {
+    content: {
+      type: 'html',
+      mutable: false,
+    },
+
     style: {
       // This awkward syntax is because the slot descriptor validator can't
       // differentiate between a function that returns a validator (the usual
@@ -27,12 +32,15 @@ export default {
 
   generate(data, slots, {html, language}) {
     const linkAttributes = html.attributes();
+    let linkContent = slots.content;
 
-    let linkContent =
-      language.formatExternalLink(data.url, {
-        style: slots.style,
-        context: slots.context,
-      });
+    if (html.isBlank(linkContent)) {
+      linkContent =
+        language.formatExternalLink(data.url, {
+          style: slots.style,
+          context: slots.context,
+        });
+    }
 
     // Fall back to platform if nothing matched the desired style.
     if (html.isBlank(linkContent) && slots.style !== 'platform') {