diff --git a/.eleventy.js b/.eleventy.js index 9b45e65cc5..637a69c875 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -107,7 +107,7 @@ module.exports = function(eleventyConfig) { }); // Add a global data variable for the current date - eleventyConfig.addGlobalData("currentDateISO", new Date().toISOString()); + eleventyConfig.addGlobalData("currentDateISO", new Date().toISOString()); // Make filters globally accessible global.isFuturePost = eleventyConfig.getFilter('isFuturePost'); @@ -226,6 +226,13 @@ module.exports = function(eleventyConfig) { eleventyConfig.addFilter("limit", (arr, limit) => arr.slice(0, limit )); + // Marketing image for a nav highlight card: the linked page's image front matter + eleventyConfig.addFilter("pageImageForUrl", (collection, url) => { + const normalized = url && !url.endsWith("/") ? `${url}/` : url; + const match = (collection || []).find((p) => p.url === normalized); + return (match && match.data && match.data.image) || null; + }); + eleventyConfig.addFilter('console', function (value) { const str = util.inspect(value, { showHidden: false, depth: null }); return `