« get me outta code hell

data, content: Album.musicVideos - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2026-01-31 23:02:08 -0400
committer(quasar) nebula <qznebula@protonmail.com>2026-01-31 23:03:14 -0400
commit7ef4941fa8cc00b0ea128f51fd859f264800fe05 (patch)
treec006e2e01448a205d532ee129a29c88323fe68dc /src/content
parent180d3e169b10db5f1837567eca9bf1b2d5542b96 (diff)
data, content: Album.musicVideos
Diffstat (limited to 'src/content')
-rw-r--r--src/content/dependencies/generateAlbumArtworkColumn.js5
-rw-r--r--src/content/dependencies/generateMusicVideoDateLine.js3
2 files changed, 7 insertions, 1 deletions
diff --git a/src/content/dependencies/generateAlbumArtworkColumn.js b/src/content/dependencies/generateAlbumArtworkColumn.js
index 5346e56b..cc27e6b4 100644
--- a/src/content/dependencies/generateAlbumArtworkColumn.js
+++ b/src/content/dependencies/generateAlbumArtworkColumn.js
@@ -31,6 +31,10 @@ export default {
             .map(artwork => relation('generateCoverArtwork', artwork))
 
         : []),
+
+    musicVideos:
+      album.musicVideos.map(musicVideo =>
+        relation('generateMusicVideo', musicVideo, album)),
   }),
 
   generate(relations, {html}) {
@@ -46,6 +50,7 @@ export default {
       relations.firstCovers,
       relations.albumArtInfoBox,
       relations.restCovers,
+      relations.musicVideos,
     ]);
   },
 };
diff --git a/src/content/dependencies/generateMusicVideoDateLine.js b/src/content/dependencies/generateMusicVideoDateLine.js
index 0c30ead5..98992584 100644
--- a/src/content/dependencies/generateMusicVideoDateLine.js
+++ b/src/content/dependencies/generateMusicVideoDateLine.js
@@ -2,6 +2,7 @@ function sameDay(musicVideo, thing) {
   if (!musicVideo.dateIsSpecified) return null;
 
   const compare = (a, b) =>
+    a && b &&
     a.toDateString() === b.toDateString();
 
   const album = thing.isTrack ? thing.album : thing;
@@ -15,7 +16,7 @@ function sameDay(musicVideo, thing) {
     }
   }
 
-  if (compare(musicVideo.date, track.date)) {
+  if (compare(musicVideo.date, track?.date)) {
     return 'track';
   }