« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/page
diff options
context:
space:
mode:
Diffstat (limited to 'src/page')
-rw-r--r--src/page/album.js28
-rw-r--r--src/page/art-tag.js (renamed from src/page/tag.js)14
-rw-r--r--src/page/artist.js10
-rw-r--r--src/page/group.js39
-rw-r--r--src/page/homepage.js2
-rw-r--r--src/page/index.js2
-rw-r--r--src/page/track.js12
7 files changed, 70 insertions, 37 deletions
diff --git a/src/page/album.js b/src/page/album.js
index 46b1446b..696e2854 100644
--- a/src/page/album.js
+++ b/src/page/album.js
@@ -38,20 +38,28 @@ export function pathsForTarget(album) {
       },
     },
 
-    !empty(album.referencedArtworks) && {
+    {
       type: 'page',
       path: ['albumReferencedArtworks', album.directory],
 
+      condition: () =>
+        album.hasCoverArt &&
+        !empty(album.coverArtworks[0].referencedArtworks),
+
       contentFunction: {
         name: 'generateAlbumReferencedArtworksPage',
         args: [album],
       },
     },
 
-    !empty(album.referencedByArtworks) && {
+    {
       type: 'page',
       path: ['albumReferencingArtworks', album.directory],
 
+      condition: () =>
+        album.hasCoverArt &&
+        !empty(album.coverArtworks[0].referencedByArtworks),
+
       contentFunction: {
         name: 'generateAlbumReferencingArtworksPage',
         args: [album],
@@ -80,13 +88,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/',
+    },
   ];
 }
 
diff --git a/src/page/tag.js b/src/page/art-tag.js
index 8942aea9..5b61229d 100644
--- a/src/page/tag.js
+++ b/src/page/art-tag.js
@@ -1,6 +1,6 @@
 // Art tag page specification.
 
-export const description = `per-artwork-tag gallery pages`;
+export const description = `per-art-tag info & gallery pages`;
 
 export function condition({wikiData}) {
   return wikiData.wikiInfo.enableArtTagUI;
@@ -14,7 +14,17 @@ export function pathsForTarget(tag) {
   return [
     {
       type: 'page',
-      path: ['tag', tag.directory],
+      path: ['artTagInfo', tag.directory],
+
+      contentFunction: {
+        name: 'generateArtTagInfoPage',
+        args: [tag],
+      },
+    },
+
+    {
+      type: 'page',
+      path: ['artTagGallery', tag.directory],
 
       contentFunction: {
         name: 'generateArtTagGalleryPage',
diff --git a/src/page/artist.js b/src/page/artist.js
index b68cf05c..257e060d 100644
--- a/src/page/artist.js
+++ b/src/page/artist.js
@@ -8,10 +8,6 @@ export function targets({wikiData}) {
 }
 
 export function pathsForTarget(artist) {
-  const hasGalleryPage =
-    !empty(artist.albumCoverArtistContributions) ||
-    !empty(artist.trackCoverArtistContributions);
-
   return [
     {
       type: 'page',
@@ -23,10 +19,14 @@ export function pathsForTarget(artist) {
       },
     },
 
-    hasGalleryPage && {
+    {
       type: 'page',
       path: ['artistGallery', artist.directory],
 
+      condition: () =>
+        !empty(artist.albumCoverArtistContributions) ||
+        !empty(artist.trackCoverArtistContributions),
+
       contentFunction: {
         name: 'generateArtistGalleryPage',
         args: [artist],
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/',
+    },
   ];
 }
diff --git a/src/page/homepage.js b/src/page/homepage.js
index 53ee6e46..cfcdd6e1 100644
--- a/src/page/homepage.js
+++ b/src/page/homepage.js
@@ -7,7 +7,7 @@ export function pathsTargetless({wikiData}) {
       path: ['home'],
 
       contentFunction: {
-        name: 'generateWikiHomePage',
+        name: 'generateWikiHomepagePage',
         args: [wikiData.homepageLayout],
       },
     },
diff --git a/src/page/index.js b/src/page/index.js
index 21d93c8f..ae480136 100644
--- a/src/page/index.js
+++ b/src/page/index.js
@@ -1,6 +1,7 @@
 export * as album from './album.js';
 export * as artist from './artist.js';
 export * as artistAlias from './artist-alias.js';
+export * as artTag from './art-tag.js';
 export * as flash from './flash.js';
 export * as flashAct from './flash-act.js';
 export * as group from './group.js';
@@ -8,5 +9,4 @@ export * as homepage from './homepage.js';
 export * as listing from './listing.js';
 export * as news from './news.js';
 export * as static from './static.js';
-export * as tag from './tag.js';
 export * as track from './track.js';
diff --git a/src/page/track.js b/src/page/track.js
index 94a1e48d..95647334 100644
--- a/src/page/track.js
+++ b/src/page/track.js
@@ -20,20 +20,28 @@ export function pathsForTarget(track) {
       },
     },
 
-    !empty(track.referencedArtworks) && {
+    {
       type: 'page',
       path: ['trackReferencedArtworks', track.directory],
 
+      condition: () =>
+        track.hasUniqueCoverArt &&
+        !empty(track.trackArtworks[0].referencedArtworks),
+
       contentFunction: {
         name: 'generateTrackReferencedArtworksPage',
         args: [track],
       },
     },
 
-    !empty(track.referencedByArtworks) && {
+    {
       type: 'page',
       path: ['trackReferencingArtworks', track.directory],
 
+      condition: () =>
+        track.hasUniqueCoverArt &&
+        !empty(track.trackArtworks[0].referencedByArtworks),
+
       contentFunction: {
         name: 'generateTrackReferencingArtworksPage',
         args: [track],