« get me outta code hell

content: linkExternal: add tab: 'separate' slot - 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-11-07 20:30:26 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-11-16 14:29:52 -0400
commit2834bc41d1f141402f14a64f0c513997f43c4dc4 (patch)
treed83edbb5686acb133b70564b2124c1fd6f63dfb9
parentc9c8ccfbeb6a013131dee429da0f12192364a8d0 (diff)
content: linkExternal: add tab: 'separate' slot
-rw-r--r--src/content/dependencies/linkExternal.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/content/dependencies/linkExternal.js b/src/content/dependencies/linkExternal.js
index 5de612e2..4a0959c0 100644
--- a/src/content/dependencies/linkExternal.js
+++ b/src/content/dependencies/linkExternal.js
@@ -24,6 +24,11 @@ export default {
       validate: v => v.is('generic', 'album', 'flash'),
       default: 'generic',
     },
+
+    tab: {
+      validate: v => v.is('default', 'separate'),
+      default: 'default',
+    },
   },
 
   generate(data, slots, {html, language}) {
@@ -53,6 +58,10 @@ export default {
       {
         href: data.url,
         class: 'nowrap',
+        target:
+          (slots.tab === 'separate'
+            ? '_blank'
+            : null),
       },
 
       // truly unhinged indentation here