« get me outta code hell

data, content: embed scripts on static pages - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateStaticPage.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-11-27 21:13:39 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-11-27 21:13:39 -0400
commita65693efe23b97da173463f207979f81767d791c (patch)
tree75687a16de9476eebe68163deab7b037e125af70 /src/content/dependencies/generateStaticPage.js
parent930bb9e0f1fc7167dbf53636246e3cd2de773774 (diff)
data, content: embed scripts on static pages
Diffstat (limited to 'src/content/dependencies/generateStaticPage.js')
-rw-r--r--src/content/dependencies/generateStaticPage.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/content/dependencies/generateStaticPage.js b/src/content/dependencies/generateStaticPage.js
index 3e27fd43..226152c7 100644
--- a/src/content/dependencies/generateStaticPage.js
+++ b/src/content/dependencies/generateStaticPage.js
@@ -1,5 +1,6 @@
 export default {
   contentDependencies: ['generatePageLayout', 'transformContent'],
+  extraDependencies: ['html'],
 
   relations(relation, staticPage) {
     return {
@@ -12,10 +13,11 @@ export default {
     return {
       name: staticPage.name,
       stylesheet: staticPage.stylesheet,
+      script: staticPage.script,
     };
   },
 
-  generate(data, relations) {
+  generate(data, relations, {html}) {
     return relations.layout
       .slots({
         title: data.name,
@@ -27,7 +29,12 @@ export default {
             : []),
 
         mainClasses: ['long-content'],
-        mainContent: relations.content,
+        mainContent: [
+          relations.content,
+
+          data.script &&
+            html.tag('script', data.script),
+        ],
 
         navLinkStyle: 'hierarchical',
         navLinks: [