« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateArtistGalleryPage.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies/generateArtistGalleryPage.js')
-rw-r--r--src/content/dependencies/generateArtistGalleryPage.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/content/dependencies/generateArtistGalleryPage.js b/src/content/dependencies/generateArtistGalleryPage.js
index 39be9d91..11cf8cdf 100644
--- a/src/content/dependencies/generateArtistGalleryPage.js
+++ b/src/content/dependencies/generateArtistGalleryPage.js
@@ -14,8 +14,16 @@ export default {
   extraDependencies: ['html', 'language'],
 
   query(artist) {
-    const things = [...artist.albumsAsCoverArtist, ...artist.tracksAsCoverArtist];
-    sortAlbumsTracksChronologically(things, {latestFirst: true});
+    const things = [
+      ...artist.albumsAsCoverArtist,
+      ...artist.tracksAsCoverArtist,
+    ];
+
+    sortAlbumsTracksChronologically(things, {
+      latestFirst: true,
+      getDate: thing => thing.coverArtDate ?? thing.date,
+    });
+
     return {things};
   },