« get me outta code hell

content: generatePageLayout: showWikiName: 'auto' - 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>2024-11-17 14:21:05 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-11-17 16:35:12 -0400
commitc4d11bebb50f1ac2f07a06732b12f6d471bd1bf0 (patch)
treebf1818bec921cd620f0f809ee876dd5f8309ba96
parent36dd9637dcdd62ae16dec31c9325b439d11a95e4 (diff)
content: generatePageLayout: showWikiName: 'auto'
-rw-r--r--src/content/dependencies/generatePageLayout.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/content/dependencies/generatePageLayout.js b/src/content/dependencies/generatePageLayout.js
index cc8bc777..ec1b3156 100644
--- a/src/content/dependencies/generatePageLayout.js
+++ b/src/content/dependencies/generatePageLayout.js
@@ -70,8 +70,8 @@ export default {
     },
 
     showWikiNameInTitle: {
-      type: 'boolean',
-      default: true,
+      validate: v => v.is(true, false, 'auto'),
+      default: 'auto',
     },
 
     subtitle: {
@@ -631,7 +631,14 @@ export default {
                   workingOptions.subtitle = slots.subtitle;
                 }
 
-                if (slots.showWikiNameInTitle) {
+                const showWikiName =
+                  (slots.showWikiNameInTitle === true
+                    ? true
+                 : slots.showWikiNameInTitle === 'auto'
+                    ? html.isBlank(slots.subtitle)
+                    : false);
+
+                if (showWikiName) {
                   workingCapsule += '.withWikiName';
                   workingOptions.wikiName = data.wikiName;
                 }