From 0337711ed78c05418ba793b71fde082d96b1cb5b Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 16 Nov 2024 12:08:47 -0400 Subject: content: generate{Artist,Group}InfoPage: close group/artist links --- src/content/dependencies/generateArtistInfoPage.js | 20 ++++++++++++++++++++ src/content/dependencies/generateGroupInfoPage.js | 20 ++++++++++++++++++++ src/strings-default.yaml | 8 ++++++++ 3 files changed, 48 insertions(+) diff --git a/src/content/dependencies/generateArtistInfoPage.js b/src/content/dependencies/generateArtistInfoPage.js index f2fdc5b6..52f3e221 100644 --- a/src/content/dependencies/generateArtistInfoPage.js +++ b/src/content/dependencies/generateArtistInfoPage.js @@ -13,6 +13,7 @@ export default { 'generatePageLayout', 'linkArtistGallery', 'linkExternal', + 'linkGroup', 'transformContent', ], @@ -68,6 +69,10 @@ export default { contextNotes: relation('transformContent', artist.contextNotes), + closeGroupLinks: + artist.closelyLinkedGroups + .map(group => relation('linkGroup', group)), + visitLinks: artist.urls .map(url => relation('linkExternal', url)), @@ -146,6 +151,21 @@ export default { relations.contextNotes), ]), + html.tag('p', + {[html.onlyIfContent]: true}, + + language.encapsulate(pageCapsule, 'closelyLinkedGroups', capsule => + (relations.closeGroupLinks.length === 0 + ? html.blank() + : relations.closeGroupLinks.length === 1 + ? language.$(capsule, 'one', { + group: relations.closeGroupLinks, + }) + : language.$(capsule, 'multiple', { + groups: + language.formatUnitList(relations.closeGroupLinks), + })))), + html.tag('p', {[html.onlyIfContent]: true}, diff --git a/src/content/dependencies/generateGroupInfoPage.js b/src/content/dependencies/generateGroupInfoPage.js index 87f35656..31f43208 100644 --- a/src/content/dependencies/generateGroupInfoPage.js +++ b/src/content/dependencies/generateGroupInfoPage.js @@ -5,6 +5,7 @@ export default { 'generateGroupSecondaryNav', 'generateGroupSidebar', 'generatePageLayout', + 'linkArtist', 'linkExternal', 'transformContent', ], @@ -33,6 +34,10 @@ export default { ? relation('generateGroupSidebar', group) : null), + closeArtistLinks: + group.closelyLinkedArtists + .map(artist => relation('linkArtist', artist)), + visitLinks: group.urls .map(url => relation('linkExternal', url)), @@ -60,6 +65,21 @@ export default { color: data.color, mainContent: [ + html.tag('p', + {[html.onlyIfContent]: true}, + + language.encapsulate(pageCapsule, 'closelyLinkedArtists', capsule => + (relations.closeArtistLinks.length === 0 + ? html.blank() + : relations.closeArtistLinks.length === 1 + ? language.$(capsule, 'one', { + artist: relations.closeArtistLinks, + }) + : language.$(capsule, 'multiple', { + artists: + language.formatUnitList(relations.closeArtistLinks), + })))), + html.tag('p', {[html.onlyIfContent]: true}, diff --git a/src/strings-default.yaml b/src/strings-default.yaml index 5838aa7d..7d85bf15 100644 --- a/src/strings-default.yaml +++ b/src/strings-default.yaml @@ -1073,6 +1073,10 @@ artistPage: nav: artist: "Artist: {ARTIST}" + closelyLinkedGroups: + one: "This artist has a group page: {GROUP}." + multiple: "This artist has group pages: {GROUPS}." + creditList: # album: @@ -1306,6 +1310,10 @@ groupPage: groupInfoPage: title: "{GROUP}" + closelyLinkedArtists: + one: "View artist page: {ARTIST}." + multiple: "View artist pages: {ARTISTS}." + viewAlbumGallery: _: >- View {LINK}! Or browse the list: -- cgit 1.3.0-6-gf8a5