From 176a101892a19265e27ba443439236584c6c0021 Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Tue, 23 Mar 2021 10:49:14 -0500 Subject: [PATCH] Maintain label when first link is app test --- pages-eleventy/app.11ty.js | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/pages-eleventy/app.11ty.js b/pages-eleventy/app.11ty.js index 7f61b3e..5e4c818 100644 --- a/pages-eleventy/app.11ty.js +++ b/pages-eleventy/app.11ty.js @@ -22,6 +22,25 @@ export const makeDescription = function ( app ) { return `Latest reported support status of ${ app.name } on Apple Silicon and Apple M1 Processors.` } +export function renderPageLinksHtml ( links ) { + return links.map( (link, i) => { + + const notAppTestLink = !link.label.includes('🧪') + + const isMainLink = (i === 0) && notAppTestLink + + return /* html */` + ${ isMainLink ? 'View' : link.label } + ` + } ).join('') +} + export class AppTemplate { // or `async data() {` // or `get data() {` @@ -71,17 +90,7 @@ export class AppTemplate { const lastUpdatedFriendly = makeLastUpdatedFriendly( app.lastUpdated ) - const relatedLinksHtml = app.relatedLinks.map( (link, i) => { - return /* html */` - ${ (i === 0) ? 'View' : link.label } - ` - } ).join('') + const relatedLinksHtml = renderPageLinksHtml( app.relatedLinks ) return /* html */`