From a328c845c0e8c89a9ca39a33c18016a1a88e023b Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 7 Nov 2023 20:33:37 -0400 Subject: content: generateAlbumCommentaryPage: track listening links --- .../dependencies/generateAlbumCommentaryPage.js | 32 ++++++++++++++++++++-- src/strings-default.yaml | 4 ++- 2 files changed, 33 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/content/dependencies/generateAlbumCommentaryPage.js b/src/content/dependencies/generateAlbumCommentaryPage.js index 001003ae..3e97c379 100644 --- a/src/content/dependencies/generateAlbumCommentaryPage.js +++ b/src/content/dependencies/generateAlbumCommentaryPage.js @@ -11,6 +11,7 @@ export default { 'generateTrackCoverArtwork', 'generatePageLayout', 'linkAlbum', + 'linkExternal', 'linkTrack', ], @@ -54,6 +55,11 @@ export default { tracksWithCommentary .map(track => relation('linkTrack', track)); + relations.trackCommentaryListeningLinks = + tracksWithCommentary + .map(track => + track.urls.map(url => relation('linkExternal', url))); + relations.trackCommentaryCovers = tracksWithCommentary .map(track => @@ -156,15 +162,37 @@ export default { stitchArrays({ heading: relations.trackCommentaryHeadings, link: relations.trackCommentaryLinks, + listeningLinks: relations.trackCommentaryListeningLinks, directory: data.trackCommentaryDirectories, cover: relations.trackCommentaryCovers, entries: relations.trackCommentaryEntries, color: data.trackCommentaryColors, - }).map(({heading, link, directory, cover, entries, color}) => [ + }).map(({ + heading, + link, + listeningLinks, + directory, + cover, + entries, + color, + }) => [ heading.slots({ tag: 'h3', id: directory, - title: link, + color, + + title: + language.$('albumCommentaryPage.entry.title.trackCommentary', { + track: link, + }), + + accent: + language.$('albumCommentaryPage.entry.title.trackCommentary.accent', { + listeningLinks: + language.formatUnitList( + listeningLinks.map(link => + link.slot('tab', 'separate'))), + }), }), cover?.slots({mode: 'commentary'}), diff --git a/src/strings-default.yaml b/src/strings-default.yaml index 5a3d172f..30261e80 100644 --- a/src/strings-default.yaml +++ b/src/strings-default.yaml @@ -754,7 +754,9 @@ albumCommentaryPage: entry: title: albumCommentary: "Album commentary" - trackCommentary: "{TRACK}" + trackCommentary: + _: "{TRACK}" + accent: "({LISTENING_LINKS})" # # artistInfoPage: -- cgit 1.3.0-6-gf8a5