From b63f9077aed72e4191a2e82634d2307522d3b98c Mon Sep 17 00:00:00 2001 From: Zach Leatherman Date: Wed, 28 Jul 2021 08:57:25 -0500 Subject: [PATCH] Additional safety for head check --- .eleventy.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.eleventy.js b/.eleventy.js index 9e46827..eb21532 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -29,6 +29,9 @@ module.exports = function(eleventyConfig) { // Get the first `n` elements of a collection. eleventyConfig.addFilter("head", (array, n) => { + if(!Array.isArray(array) || array.length === 0) { + return []; + } if( n < 0 ) { return array.slice(n); }