Merge pull request #13 from mathiasbynens/patch-1

Simplify collection filtering using `startsWith`
This commit is contained in:
Zach Leatherman 2018-08-17 09:34:48 -05:00 committed by GitHub
commit ec2c6f5b05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,7 +15,7 @@ module.exports = function(eleventyConfig) {
// only content in the `posts/` directory // only content in the `posts/` directory
eleventyConfig.addCollection("posts", function(collection) { eleventyConfig.addCollection("posts", function(collection) {
return collection.getAllSorted().filter(function(item) { return collection.getAllSorted().filter(function(item) {
return item.inputPath.match(/^\.\/posts\//) !== null; return item.inputPath.startsWith('./posts');
}); });
}); });