« get me outta code hell

content: generatePageLayout: support manual current: true - 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-07-26 10:10:39 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-07-26 10:10:39 -0300
commitde409aecc04718cdf2874d9876bc16ffdb645bfa (patch)
tree7c814735548545ebafe13e9e348955a7ffaf951f /src/content/dependencies
parent523243bf1f8ffd7771e1f157655011542c50bc09 (diff)
content: generatePageLayout: support manual current: true
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/generatePageLayout.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/content/dependencies/generatePageLayout.js b/src/content/dependencies/generatePageLayout.js
index b764595a..fe2bef99 100644
--- a/src/content/dependencies/generatePageLayout.js
+++ b/src/content/dependencies/generatePageLayout.js
@@ -160,8 +160,14 @@ export default {
             path: () => true,
             title: () => true,
             accent: () => true,
+
+            current: () => true,
           }), object);
 
+          if (object.current !== undefined) {
+            aggregate.call(v.isBoolean, object.current);
+          }
+
           if (object.auto || object.html) {
             if (object.auto && object.html) {
               aggregate.push(new TypeError(`Don't specify both auto and html`));
@@ -309,11 +315,11 @@ export default {
 
               let className;
 
-              if (cur.auto === 'current') {
-                className = 'current';
-              } else if (
-                slots.navLinkStyle === 'hierarchical' &&
-                i === slots.navLinks.length - 1
+              if (
+                cur.current ||
+                cur.auto === 'current' ||
+                (slots.navLinkStyle === 'hierarchical' &&
+                  i === slots.navLinks.length - 1)
               ) {
                 className = 'current';
               }