« get me outta code hell

content: generateStaticPage - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-05-26 14:10:48 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-05-26 14:10:48 -0300
commitb6cba67c7acd79affb2449f5c8582b6b1fe928ac (patch)
treee26da03892668084e346d576d759fc729f9bec99 /src/content/dependencies
parentbb7faef7695fa7f7a00b9b1b4fb99267813d9bfa (diff)
content: generateStaticPage
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/generateStaticPage.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/content/dependencies/generateStaticPage.js b/src/content/dependencies/generateStaticPage.js
new file mode 100644
index 00000000..e3063ff8
--- /dev/null
+++ b/src/content/dependencies/generateStaticPage.js
@@ -0,0 +1,36 @@
+export default {
+  contentDependencies: ['generatePageLayout', 'transformContent'],
+
+  relations(relation, staticPage) {
+    return {
+      layout: relation('generatePageLayout'),
+      content: relation('transformContent', staticPage.content),
+    };
+  },
+
+  data(staticPage) {
+    return {
+      name: staticPage.name,
+      stylesheet: staticPage.stylesheet,
+    };
+  },
+
+  generate(data, relations) {
+    return relations.layout
+      .slots({
+        title: data.name,
+        headingMode: 'sticky',
+
+        styleRules: [data.stylesheet].filter(Boolean),
+
+        mainClasses: ['long-content'],
+        mainContent: relations.content,
+
+        navLinkStyle: 'hierarchical',
+        navLinks: [
+          {auto: 'home'},
+          {auto: 'current'},
+        ],
+      });
+  },
+};