diff options
-rw-r--r-- | src/content/dependencies/generateArtTagInfoPage.js | 72 | ||||
-rw-r--r-- | src/strings-default.json | 8 |
2 files changed, 60 insertions, 20 deletions
diff --git a/src/content/dependencies/generateArtTagInfoPage.js b/src/content/dependencies/generateArtTagInfoPage.js index f8354269..7b9d47b9 100644 --- a/src/content/dependencies/generateArtTagInfoPage.js +++ b/src/content/dependencies/generateArtTagInfoPage.js @@ -5,7 +5,8 @@ export default { 'generateArtTagNavLinks', 'generateContentHeading', 'generatePageLayout', - 'linkArtTag', + 'linkArtTagGallery', + 'linkArtTagInfo', 'linkExternal', 'transformContent', ], @@ -43,6 +44,11 @@ export default { relation('transformContent', artTag.description); } + if (!empty(query.allThings)) { + info.galleryLink = + relation('linkArtTagGallery', artTag); + } + if (!empty(artTag.extraReadingURLs)) { info.extraReadingLinks = artTag.extraReadingURLs @@ -57,7 +63,7 @@ export default { ancestors.directAncestorLinks = artTag.directAncestorArtTags - .map(artTag => relation('linkArtTag', artTag)); + .map(artTag => relation('linkArtTagInfo', artTag)); } if (!empty(artTag.directDescendantArtTags)) { @@ -68,7 +74,7 @@ export default { descendants.directDescendantLinks = artTag.directDescendantArtTags - .map(artTag => relation('linkArtTag', artTag)); + .map(artTag => relation('linkArtTagInfo', artTag)); } return relations; @@ -82,7 +88,9 @@ export default { data.name = artTag.name; data.color = artTag.color; - data.numArtworks = query.allThings.length; + data.numArtworksIndirectly = query.indirectThings.length; + data.numArtworksDirectly = query.directThings.length; + data.numArtworksTotal = query.allThings.length; data.names = query.allThings.map(thing => thing.name); @@ -102,22 +110,38 @@ export default { generate(data, relations, {html, language}) { const {sections: sec} = relations; + const nameOption = {tag: language.sanitize(data.name)}; return relations.layout .slots({ - title: - language.$('artTagInfoPage.title', { - tag: data.name, - }), - - headingMode: 'static', + title: language.$('artTagInfoPage.title', nameOption), + headingMode: 'sticky', color: data.color, mainContent: [ - sec.info.extraReadingLinks && + html.tag('p', + (data.numArtworksTotal === 0 + ? language.$('artTagInfoPage.featuredIn.notFeatured') + : data.numArtworksDirectly === 0 + ? language.$('artTagInfoPage.featuredIn.indirectlyOnly', { + artworks: language.countArtworks(data.numArtworksIndirectly, {unit: true}), + }) + : data.numArtworksIndirectly === 0 + ? language.$('artTagInfoPage.featuredIn.directlyOnly', { + artworks: language.countArtworks(data.numArtworksDirectly, {unit: true}), + }) + : language.$('artTagInfoPage.featuredIn.directlyAndIndirectly', { + artworksDirectly: language.countArtworks(data.numArtworksDirectly, {unit: true}), + artworksIndirectly: language.countArtworks(data.numArtworksIndirectly, {unit: false}), + artworksTotal: language.countArtworks(data.numArtworksTotal, {unit: false}), + }))), + + sec.info.galleryLink && html.tag('p', - language.$('releaseInfo.readMoreOn', { - links: language.formatDisjunctionList(sec.info.extraReadingLinks), + language.$('artTagInfoPage.viewArtGallery', { + link: + sec.info.galleryLink + .slot('content', language.$('artTagInfoPage.viewArtGallery.link')), })), html.tag('blockquote', @@ -125,11 +149,17 @@ export default { sec.info.description ?.slot('mode', 'multiline')), + sec.info.extraReadingLinks && + html.tag('p', + language.$('artTagInfoPage.readMoreOn', { + ...nameOption, + links: language.formatDisjunctionList(sec.info.extraReadingLinks), + })), + sec.ancestors && [ sec.ancestors.heading - .slot('title', language.$('artTagInfoPage.descendsFromTags', { - tag: language.sanitize(data.name), - })), + .slot('title', + language.$('artTagInfoPage.descendsFromTags', nameOption)), html.tag('ul', sec.ancestors.directAncestorLinks @@ -138,9 +168,8 @@ export default { sec.descendants && [ sec.descendants.heading - .slot('title', language.$('artTagInfoPage.descendantTags', { - tag: language.sanitize(data.name), - })), + .slot('title', + language.$('artTagInfoPage.descendantTags', nameOption)), html.tag('ul', sec.descendants.directDescendantLinks @@ -150,6 +179,11 @@ export default { navLinkStyle: 'hierarchical', navLinks: relations.navLinks.content, + + leftSidebarMultiple: [ + {content: `I'm a sidebar.`}, + {content: `I am another sidebar.`}, + ], }); }, }; diff --git a/src/strings-default.json b/src/strings-default.json index 3a2a4994..7f7a3646 100644 --- a/src/strings-default.json +++ b/src/strings-default.json @@ -120,7 +120,6 @@ "releaseInfo.listenOn.noLinks": "This wiki doesn't have any listening links for {NAME}.", "releaseInfo.visitOn": "Visit on {LINKS}.", "releaseInfo.playOn": "Play on {LINKS}.", - "releaseInfo.readMoreOn": "Read more on {LINKS}.", "releaseInfo.readCommentary": "Read {LINK}.", "releaseInfo.readCommentary.link": "artist commentary", "releaseInfo.alsoReleasedAs": "Also released as:", @@ -323,6 +322,13 @@ "artistGalleryPage.infoLine": "Contributed to {COVER_ARTS}.", "artTagPage.nav.tag": "Tag: {TAG}", "artTagInfoPage.title": "{TAG}", + "artTagInfoPage.viewArtGallery": "View this tag's {LINK}!", + "artTagInfoPage.viewArtGallery.link": "art gallery", + "artTagInfoPage.readMoreOn": "Read more about {TAG} on {LINKS}.", + "artTagInfoPage.featuredIn.notFeatured": "This tag hasn't been featured in any artworks yet.", + "artTagInfoPage.featuredIn.directlyOnly": "This tag is featured in {ARTWORKS}.", + "artTagInfoPage.featuredIn.indirectlyOnly": "This tag is featured in {ARTWORKS}, but only indirectly - have a look at its descendant tags!", + "artTagInfoPage.featuredIn.directlyAndIndirectly": "This tag is directly featured in {ARTWORKS_DIRECTLY}, and indirectly in {ARTWORKS_INDIRECTLY} more, for a total of {ARTWORKS_TOTAL}.", "artTagInfoPage.descendantTags": "Tags that descend from {TAG}:", "artTagInfoPage.descendsFromTags": "Tags that {TAG} descends from:", "artTagGalleryPage.title": "{TAG}", |