« get me outta code hell

page: use path conditions - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/page/album.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-02-05 16:08:05 -0400
committer(quasar) nebula <qznebula@protonmail.com>2025-02-05 16:08:56 -0400
commitf34a6baadda3ba87cc482aee34ecb256879730c5 (patch)
tree46d85a1e48198315b2afb5a06a706983c5d55532 /src/page/album.js
parent4d5465b69989d50131ade81bc1cb8a929c64fc70 (diff)
page: use path conditions staging
Diffstat (limited to 'src/page/album.js')
-rw-r--r--src/page/album.js26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/page/album.js b/src/page/album.js
index 46b1446b..8c08b960 100644
--- a/src/page/album.js
+++ b/src/page/album.js
@@ -38,20 +38,26 @@ export function pathsForTarget(album) {
       },
     },
 
-    !empty(album.referencedArtworks) && {
+    {
       type: 'page',
       path: ['albumReferencedArtworks', album.directory],
 
+      condition: () =>
+        !empty(album.referencedArtworks),
+
       contentFunction: {
         name: 'generateAlbumReferencedArtworksPage',
         args: [album],
       },
     },
 
-    !empty(album.referencedByArtworks) && {
+    {
       type: 'page',
       path: ['albumReferencingArtworks', album.directory],
 
+      condition: () =>
+        !empty(album.referencedByArtworks),
+
       contentFunction: {
         name: 'generateAlbumReferencingArtworksPage',
         args: [album],
@@ -80,13 +86,15 @@ export function pathsTargetless({wikiData: {wikiInfo}}) {
       contentFunction: {name: 'generateCommentaryIndexPage'},
     },
 
-    wikiInfo.canonicalBase === 'https://hsmusic.wiki/' &&
-      {
-        type: 'redirect',
-        fromPath: ['page', 'list/all-commentary'],
-        toPath: ['commentaryIndex'],
-        title: 'Album Commentary',
-      },
+    {
+      type: 'redirect',
+      fromPath: ['page', 'list/all-commentary'],
+      toPath: ['commentaryIndex'],
+      title: 'Album Commentary',
+
+      condition: () =>
+        wikiInfo.canonicalBase === 'https://hsmusic.wiki/',
+    },
   ];
 }