From 250b0279844f020753eae6ced6e7c34f0b224347 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 15 Jun 2023 17:28:59 -0300 Subject: content, test: linkContribution: only show first four icons --- src/content/dependencies/linkContribution.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/content') diff --git a/src/content/dependencies/linkContribution.js b/src/content/dependencies/linkContribution.js index 210d5b01..c9b514fe 100644 --- a/src/content/dependencies/linkContribution.js +++ b/src/content/dependencies/linkContribution.js @@ -16,9 +16,12 @@ export default { relations.artistLink = relation('linkArtist', artist); - relations.artistIcons = - (artist.urls ?? []).map(url => - relation('linkExternalAsIcon', url)); + if (!empty(artist.urls)) { + relations.artistIcons = + artist.urls + .slice(0, 4) + .map(url => relation('linkExternalAsIcon', url)); + } return relations; }, @@ -34,7 +37,7 @@ export default { generate(data, relations, slots, {html, language}) { const hasContributionPart = !!(slots.showContribution && data.contribution); - const hasExternalPart = !!(slots.showIcons && !empty(relations.artistIcons)); + const hasExternalPart = !!(slots.showIcons && relations.artistIcons); const externalLinks = hasExternalPart && html.tag('span', -- cgit 1.3.0-6-gf8a5