From 82ec1d8e163f54404d4a6f96ceac614b8d3774c2 Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 17 Dec 2024 17:08:25 -0600 Subject: [PATCH] Website: update article links on /testimonials page (#24850) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes: #24746 Changes: - Replaced the hard-coded links to articles on the /testimonials page with server-side rendered generated links to articles. These links are now built using the website's markdown articles configuration. - Added support for a new meta tag on articles: `showOnTestimonialsPageWithEmoji` If provided and set to one of the four supported emoji (πŸ₯€, πŸ”Œ, πŸšͺ, or πŸͺŸ), a link to the article will be added to the /testimonials page. Example: ``. - Updated the build-static-content script to throw an error if an article has an invalid `showOnTestimonialsPageWithEmoji` meta tag value. - Updated recent case study articles to have a `showOnTestimonialsPageWithEmoji` meta tag. @Drew-P-drawers When this PR is merged, you can add links to the new case studies articles to the /testimonials page with a `showOnTestimonialsPageWithEmoji` meta tag. The definitions for each of the supported emoji are in this [google doc](https://docs.google.com/document/d/1-KWQa3uMIJzeitzDRmzT3SnUoFCfcFCb6K2lyVt-Gy0/edit?tab=t.0#heading=h.oskipmb8530l) --- .../consolidate-multiple-tools-with-fleet.md | 1 + .../foursquare-quickly-migrates-to-fleet.md | 1 + ...simplifies-device-management-with-fleet.md | 1 + ...social-media-platform-switches-to-fleet.md | 2 ++ ...nhances-server-observability-with-fleet.md | 1 + ...nsitions-to-fleet-for-endpoint-security.md | 1 + ...cation-platform-chooses-fleet-for-linux.md | 1 + website/api/controllers/view-testimonials.js | 18 +++++++++++++++- website/scripts/build-static-content.js | 10 +++++++-- website/views/pages/testimonials.ejs | 21 +++---------------- 10 files changed, 36 insertions(+), 21 deletions(-) diff --git a/articles/consolidate-multiple-tools-with-fleet.md b/articles/consolidate-multiple-tools-with-fleet.md index 9de6c4cad0..273e9b5c11 100644 --- a/articles/consolidate-multiple-tools-with-fleet.md +++ b/articles/consolidate-multiple-tools-with-fleet.md @@ -88,3 +88,4 @@ To learn more about how Fleet can support your organization, visit [fleetdm.com/ + diff --git a/articles/foursquare-quickly-migrates-to-fleet.md b/articles/foursquare-quickly-migrates-to-fleet.md index 0fc128180e..d926941ef5 100644 --- a/articles/foursquare-quickly-migrates-to-fleet.md +++ b/articles/foursquare-quickly-migrates-to-fleet.md @@ -87,3 +87,4 @@ Foursquare’s migration to Fleet for device management highlights its commitmen + diff --git a/articles/global-cloud-platform-simplifies-device-management-with-fleet.md b/articles/global-cloud-platform-simplifies-device-management-with-fleet.md index 79eee619d2..46f05087e3 100644 --- a/articles/global-cloud-platform-simplifies-device-management-with-fleet.md +++ b/articles/global-cloud-platform-simplifies-device-management-with-fleet.md @@ -95,3 +95,4 @@ I love Fleet. + diff --git a/articles/global-social-media-platform-switches-to-fleet.md b/articles/global-social-media-platform-switches-to-fleet.md index 6829aa7e53..4c2def7309 100644 --- a/articles/global-social-media-platform-switches-to-fleet.md +++ b/articles/global-social-media-platform-switches-to-fleet.md @@ -77,3 +77,5 @@ Transitioning to Fleet provided the platform with a strategic solution that addr + + diff --git a/articles/large-gaming-company-enhances-server-observability-with-fleet.md b/articles/large-gaming-company-enhances-server-observability-with-fleet.md index 7eec305bc3..581671e369 100644 --- a/articles/large-gaming-company-enhances-server-observability-with-fleet.md +++ b/articles/large-gaming-company-enhances-server-observability-with-fleet.md @@ -78,3 +78,4 @@ By adopting Fleet for server observability, they've successfully addressed scala + diff --git a/articles/vehicle-manufacturer-transitions-to-fleet-for-endpoint-security.md b/articles/vehicle-manufacturer-transitions-to-fleet-for-endpoint-security.md index 94aa329bd3..887b0c0275 100644 --- a/articles/vehicle-manufacturer-transitions-to-fleet-for-endpoint-security.md +++ b/articles/vehicle-manufacturer-transitions-to-fleet-for-endpoint-security.md @@ -82,3 +82,4 @@ The decision to purchase Fleet was driven by the need for a more reliable, compr + diff --git a/articles/worldwide-security-and-authentication-platform-chooses-fleet-for-linux.md b/articles/worldwide-security-and-authentication-platform-chooses-fleet-for-linux.md index d2b83d2788..a3409ea006 100644 --- a/articles/worldwide-security-and-authentication-platform-chooses-fleet-for-linux.md +++ b/articles/worldwide-security-and-authentication-platform-chooses-fleet-for-linux.md @@ -87,3 +87,4 @@ To learn more about how Fleet can support your organization, visit [fleetdm.com/ + diff --git a/website/api/controllers/view-testimonials.js b/website/api/controllers/view-testimonials.js index 7021cef382..105844863d 100644 --- a/website/api/controllers/view-testimonials.js +++ b/website/api/controllers/view-testimonials.js @@ -21,7 +21,7 @@ module.exports = { if (!_.isObject(sails.config.builtStaticContent) || !_.isArray(sails.config.builtStaticContent.testimonials) || !sails.config.builtStaticContent.compiledPagePartialsAppPath) { throw {badConfig: 'builtStaticContent.testimonials'}; } - // Get testimonials for the component. + // Get testimonials for the page contents let testimonials = _.clone(sails.config.builtStaticContent.testimonials); // Filter the testimonials by product category @@ -97,11 +97,27 @@ module.exports = { return testimonial.youtubeVideoUrl; }); + // Get articles with a showOnTestimonialsPageWithEmoji meta tag to display on this page. + let articles = sails.config.builtStaticContent.markdownPages.filter((page)=>{ + if(_.startsWith(page.htmlId, 'articles')) { + return page; + } + }); + let articlesForThisPage = _.filter(articles, (article)=>{ + return article.meta.showOnTestimonialsPageWithEmoji; + }); + // Sort the articles by their publish date. + articlesForThisPage = _.sortBy(articlesForThisPage, 'meta.publishedOn'); + + + + return { testimonialsForMdm, testimonialsForSoftwareManagement, testimonialsForObservability, testimonialsWithVideoLinks, + articlesForThisPage, }; } diff --git a/website/scripts/build-static-content.js b/website/scripts/build-static-content.js index 951b922532..104264662a 100644 --- a/website/scripts/build-static-content.js +++ b/website/scripts/build-static-content.js @@ -511,18 +511,24 @@ module.exports = { if (!isExternal) { // If the image is hosted on fleetdm.com, we'll modify the meta value to reference the file directly in the `website/assets/` folder embeddedMetadata.articleImageUrl = embeddedMetadata.articleImageUrl.replace(/https?:\/\//, '').replace(/^fleetdm\.com/, ''); } else { // If the value is a link to an image that will not be hosted on fleetdm.com, we'll throw an error. - throw new Error(`Failed compiling markdown content: An article page has an invalid a articleImageUrl meta tag () at "${path.join(topLvlRepoPath, pageSourcePath)}". To resolve, change the value of the meta tag to be an image that will be hosted on fleetdm.com`); + throw new Error(`Failed compiling markdown content: An article page has an invalid articleImageUrl meta tag () at "${path.join(topLvlRepoPath, pageSourcePath)}". To resolve, change the value of the meta tag to be an image that will be hosted on fleetdm.com`); } } else if(inWebsiteAssetFolder) { // If the `articleImageUrl` value is a relative link to the `website/assets/` folder, we'll modify the value to link directly to that folder. embeddedMetadata.articleImageUrl = embeddedMetadata.articleImageUrl.replace(/^\.\.\/website\/assets/g, ''); } else { // If the value is not a url and the relative link does not go to the 'website/assets/' folder, we'll throw an error. - throw new Error(`Failed compiling markdown content: An article page has an invalid a articleImageUrl meta tag () at "${path.join(topLvlRepoPath, pageSourcePath)}". To resolve, change the value of the meta tag to be a URL or repo relative link to an image in the 'website/assets/images' folder`); + throw new Error(`Failed compiling markdown content: An article page has an invalid articleImageUrl meta tag () at "${path.join(topLvlRepoPath, pageSourcePath)}". To resolve, change the value of the meta tag to be a URL or repo relative link to an image in the 'website/assets/images' folder`); } } if(embeddedMetadata.description && embeddedMetadata.description.length > 150) { // Throwing an error if the article's description meta tag value is over 150 characters long throw new Error(`Failed compiling markdown content: An article page has an invalid description meta tag () at "${path.join(topLvlRepoPath, pageSourcePath)}". To resolve, make sure the value of the meta description is less than 150 characters long.`); } + if(embeddedMetadata.showOnTestimonialsPageWithEmoji){ + // Throw an error if a showOnTestimonialsPageWithEmoji value is not one of: πŸ₯€, πŸ”Œ, πŸšͺ, or πŸͺŸ. + if(!['πŸ₯€', 'πŸ”Œ', 'πŸšͺ', 'πŸͺŸ'].includes(embeddedMetadata.showOnTestimonialsPageWithEmoji)){ + throw new Error(`Failed compiling markdown content: An article page has an invalid showOnTestimonialsPageWithEmoji meta tag () at "${path.join(topLvlRepoPath, pageSourcePath)}". To resolve, change the value of the meta tag to be one of πŸ₯€, πŸ”Œ, πŸšͺ, or πŸͺŸ and try running this script again.`); + } + } // For article pages, we'll attach the category to the `rootRelativeUrlPath`. // If the article is categorized as 'product' we'll replace the category with 'use-cases', or if it is categorized as 'success story' we'll replace it with 'device-management' rootRelativeUrlPath = ( diff --git a/website/views/pages/testimonials.ejs b/website/views/pages/testimonials.ejs index d4dd1c7153..761174aaac 100644 --- a/website/views/pages/testimonials.ejs +++ b/website/views/pages/testimonials.ejs @@ -117,26 +117,11 @@

Real-world stories of why the community and customers love Fleet.

-
+ <%for(let article of articlesForThisPage) {%>
- πŸ₯€ Leading financial company consolidates multiple tools with Fleet + <%= article.meta.showOnTestimonialsPageWithEmoji %> <%= article.meta.articleTitle %>
-
- πŸͺŸ Global edge cloud platform simplifies device management with Fleet -
-
- πŸšͺ Worldwide security and authentication platform chooses Fleet for Linux management -
-
- πŸ”Œ Large gaming company enhances server observability with Fleet -
-
- πŸšͺ Vehicle manufacturer transitions to Fleet for endpoint security -
-
- πŸšͺ Foursquare quickly migrates to Fleet for Device Management -
-
+ <% } %>