diff options
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 |
commit | f34a6baadda3ba87cc482aee34ecb256879730c5 (patch) | |
tree | 46d85a1e48198315b2afb5a06a706983c5d55532 /src/page/group.js | |
parent | 4d5465b69989d50131ade81bc1cb8a929c64fc70 (diff) |
page: use path conditions staging
Diffstat (limited to 'src/page/group.js')
-rw-r--r-- | src/page/group.js | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/src/page/group.js b/src/page/group.js index b0ed5baf..87590eaf 100644 --- a/src/page/group.js +++ b/src/page/group.js @@ -7,8 +7,6 @@ export function targets({wikiData}) { } export function pathsForTarget(group) { - const hasGalleryPage = !empty(group.albums); - return [ { type: 'page', @@ -20,10 +18,13 @@ export function pathsForTarget(group) { }, }, - hasGalleryPage && { + { type: 'page', path: ['groupGallery', group.directory], + condition: () => + !empty(group.albums), + contentFunction: { name: 'generateGroupGalleryPage', args: [group], @@ -34,20 +35,24 @@ export function pathsForTarget(group) { export function pathsTargetless({wikiData: {wikiInfo}}) { return [ - wikiInfo.canonicalBase === 'https://hsmusic.wiki/' && - { - type: 'redirect', - fromPath: ['page', 'albums/fandom'], - toPath: ['groupGallery', 'fandom'], - title: 'Fandom - Gallery', - }, + { + type: 'redirect', + fromPath: ['page', 'albums/fandom'], + toPath: ['groupGallery', 'fandom'], + title: 'Fandom - Gallery', - wikiInfo.canonicalBase === 'https://hsmusic.wiki/' && - { - type: 'redirect', - fromPath: ['page', 'albums/official'], - toPath: ['groupGallery', 'official'], - title: 'Official - Gallery', - }, + condition: () => + wikiInfo.canonicalBase === 'https://hsmusic.wiki/', + }, + + { + type: 'redirect', + fromPath: ['page', 'albums/official'], + toPath: ['groupGallery', 'official'], + title: 'Official - Gallery', + + condition: () => + wikiInfo.canonicalBase === 'https://hsmusic.wiki/', + }, ]; } |