Simplify collection filtering using startsWith
This commit is contained in:
parent
47403414ad
commit
f17db1370c
1 changed files with 1 additions and 1 deletions
|
@ -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');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue