From d31c889df346b7579ce1afe0746fb4aa0ed8227d Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 14 Feb 2024 13:07:09 -0400 Subject: content, external-links, test: provide album track count as context --- src/content/dependencies/generateAlbumReleaseInfo.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/content') diff --git a/src/content/dependencies/generateAlbumReleaseInfo.js b/src/content/dependencies/generateAlbumReleaseInfo.js index cb3aaa75..5128fbac 100644 --- a/src/content/dependencies/generateAlbumReleaseInfo.js +++ b/src/content/dependencies/generateAlbumReleaseInfo.js @@ -46,6 +46,8 @@ export default { data.duration = accumulateSum(album.tracks, track => track.duration); data.durationApproximate = album.tracks.length > 1; + data.numTracks = album.tracks.length; + return data; }, @@ -95,7 +97,14 @@ export default { relations.externalLinks .map(link => link.slots({ - context: 'album', + context: [ + 'album', + (data.numTracks === 0 + ? 'albumNoTracks' + : data.numTracks === 1 + ? 'albumOneTrack' + : 'albumMultipleTracks'), + ], style: 'normal', }))), })), -- cgit 1.3.0-6-gf8a5