diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-11-10 17:48:26 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-11-10 17:48:26 -0400 |
commit | 3f236319355b093b336e70119a7127bd23693ec2 (patch) | |
tree | b733973b50ac19cd5460ae98341c5b77fa6aaaa2 /src | |
parent | f7007f0a090f22929b450ac816757c49e17b9ef1 (diff) |
content: generateWikiHomeAlbumsRow: support albums without covers
Diffstat (limited to 'src')
-rw-r--r-- | src/content/dependencies/generateWikiHomeAlbumsRow.js | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/content/dependencies/generateWikiHomeAlbumsRow.js b/src/content/dependencies/generateWikiHomeAlbumsRow.js index cb0860f5..2c6a147e 100644 --- a/src/content/dependencies/generateWikiHomeAlbumsRow.js +++ b/src/content/dependencies/generateWikiHomeAlbumsRow.js @@ -11,7 +11,7 @@ export default { 'transformContent', ], - extraDependencies: ['wikiData'], + extraDependencies: ['language', 'wikiData'], sprawl({albumData}, row) { const sprawl = {}; @@ -90,12 +90,14 @@ export default { data.paths = sprawl.albums .map(album => - ['media.albumCover', album.directory, album.coverArtFileExtension]); + (album.hasCoverArt + ? ['media.albumCover', album.directory, album.coverArtFileExtension] + : null)); return data; }, - generate(data, relations) { + generate(data, relations, {language}) { // Grids and carousels share some slots! Very convenient. const commonSlots = {}; @@ -106,8 +108,15 @@ export default { stitchArrays({ image: relations.images, path: data.paths, - }).map(({image, path}) => - image.slot('path', path)); + name: data.names, + }).map(({image, path, name}) => + image.slots({ + path, + missingSourceContent: + language.$('misc.albumGrid.noCoverArt', { + album: name, + }), + })); commonSlots.actionLinks = (relations.actionLinks |