From f17db1370cd7002c10f80f343352033dbaac9829 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Fri, 17 Aug 2018 14:11:32 +0200 Subject: [PATCH] Simplify collection filtering using `startsWith` --- .eleventy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eleventy.js b/.eleventy.js index 6d13f5c..55c32d2 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -15,7 +15,7 @@ module.exports = function(eleventyConfig) { // only content in the `posts/` directory eleventyConfig.addCollection("posts", function(collection) { return collection.getAllSorted().filter(function(item) { - return item.inputPath.match(/^\.\/posts\//) !== null; + return item.inputPath.startsWith('./posts'); }); });