diff options
Diffstat (limited to 'src/content/dependencies/linkAlbum.js')
-rw-r--r-- | src/content/dependencies/linkAlbum.js | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/content/dependencies/linkAlbum.js b/src/content/dependencies/linkAlbum.js index 36b0d13a..f012369a 100644 --- a/src/content/dependencies/linkAlbum.js +++ b/src/content/dependencies/linkAlbum.js @@ -1,8 +1,21 @@ export default { - contentDependencies: ['linkThing'], + contentDependencies: ['linkThing', 'linkTrack'], + extraDependencies: ['language'], - relations: (relation, album) => - ({link: relation('linkThing', 'localized.album', album)}), + relations: (relation, album) => ({ + link: + (album.style === 'single' + ? relation('linkTrack', album.tracks[0]) + : relation('linkThing', 'localized.album', album)), + }), - generate: (relations) => relations.link, + data: (album) => ({ + style: album.style, + name: album.name, + }), + + generate: (data, relations, {language}) => + (data.style === 'single' + ? relations.link.slot('content', language.sanitize(data.name)) + : relations.link), }; |