« 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/generatePageLayout.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies/generatePageLayout.js')
-rw-r--r--src/content/dependencies/generatePageLayout.js34
1 files changed, 25 insertions, 9 deletions
diff --git a/src/content/dependencies/generatePageLayout.js b/src/content/dependencies/generatePageLayout.js
index e9de61df..be61a6cd 100644
--- a/src/content/dependencies/generatePageLayout.js
+++ b/src/content/dependencies/generatePageLayout.js
@@ -4,6 +4,7 @@ export default {
   contentDependencies: [
     'generateFooterLocalizationLinks',
     'generateStickyHeadingContainer',
+    'transformContent',
   ],
 
   extraDependencies: [
@@ -12,10 +13,23 @@ export default {
     'language',
     'to',
     'transformMultiline',
-    'wikiInfo',
+    'wikiData',
   ],
 
-  relations(relation) {
+  sprawl({wikiInfo}) {
+    return {
+      footerContent: wikiInfo.footerContent,
+      wikiName: wikiInfo.nameShort,
+    };
+  },
+
+  data({wikiName}) {
+    return {
+      wikiName,
+    };
+  },
+
+  relations(relation, sprawl) {
     const relations = {};
 
     relations.footerLocalizationLinks =
@@ -24,16 +38,17 @@ export default {
     relations.stickyHeadingContainer =
       relation('generateStickyHeadingContainer');
 
+    relations.defaultFooterContent =
+      relation('transformContent', sprawl.footerContent);
+
     return relations;
   },
 
-  generate(relations, {
+  generate(data, relations, {
     cachebust,
     html,
     language,
     to,
-    transformMultiline,
-    wikiInfo,
   }) {
     const sidebarSlots = side => ({
       // Content is a flat HTML array. It'll generate one sidebar section
@@ -186,8 +201,9 @@ export default {
 
         let footerContent = slots.footerContent;
 
-        if (html.isBlank(footerContent) && wikiInfo.footerContent) {
-          footerContent = transformMultiline(wikiInfo.footerContent);
+        if (html.isBlank(footerContent)) {
+          footerContent = relations.defaultFooterContent
+            .slot('mode', 'multiline');
         }
 
         const mainHTML =
@@ -251,7 +267,7 @@ export default {
 
                   switch (cur.auto) {
                     case 'home':
-                      title = wikiInfo.nameShort;
+                      title = data.wikiName;
                       href = to('localized.home');
                       break;
                     case 'current':
@@ -400,7 +416,7 @@ export default {
                   showWikiNameInTitle
                     ? language.formatString('misc.pageTitle.withWikiName', {
                         title,
-                        wikiName: wikiInfo.nameShort,
+                        wikiName: data.wikiName,
                       })
                     : language.formatString('misc.pageTitle', {title})),
                 */