« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/write/page-template.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/write/page-template.js b/src/write/page-template.js
index 617c009f..de369018 100644
--- a/src/write/page-template.js
+++ b/src/write/page-template.js
@@ -86,9 +86,10 @@ export function generateDocumentHTML(pageInfo, {
     socialEmbed = {},
   } = pageInfo;
 
+  body ||= {};
   body.style ??= '';
 
-  theme = theme || getThemeString(wikiInfo.color);
+  theme ||= getThemeString(wikiInfo.color);
 
   banner ||= {};
   banner.classes ??= [];
@@ -96,16 +97,18 @@ export function generateDocumentHTML(pageInfo, {
   banner.position ??= '';
   banner.dimensions ??= [0, 0];
 
+  main ||= {};
   main.classes ??= [];
   main.content ??= '';
   main.headingMode ??= 'none';
 
+  cover ||= {};
   cover.src ??= '';
   cover.alt ??= '';
   cover.artTags ??= [];
 
-  sidebarLeft ??= {};
-  sidebarRight ??= {};
+  sidebarLeft ||= {};
+  sidebarRight ||= {};
 
   for (const sidebar of [sidebarLeft, sidebarRight]) {
     sidebar.classes ??= [];
@@ -113,21 +116,25 @@ export function generateDocumentHTML(pageInfo, {
     sidebar.collapse ??= true;
   }
 
+  nav ||= {};
   nav.classes ??= [];
   nav.content ??= '';
   nav.bottomRowContent ??= '';
   nav.links ??= [];
   nav.linkContainerClasses ??= [];
 
-  secondaryNav ??= {};
+  secondaryNav ||= {};
   secondaryNav.content ??= '';
   secondaryNav.content ??= '';
 
+  footer ||= {};
   footer.classes ??= [];
   footer.content ??= wikiInfo.footerContent
     ? transformMultiline(wikiInfo.footerContent)
     : '';
 
+  socialEmbed ||= {};
+
   const colors = themeColor
     ? getColors(themeColor, {chroma})
     : null;