If you want to create a collection from a folder in your Eleventy project, like a collection of blog posts in the posts folder, you could manually add a post tag to every post. But there is an easier way.

The Collection API in Eleventy lets you filter your pages by glob patterns:

JavaScript
module.exports = (eleventyConfig) => {
  eleventyConfig.addCollection("posts", function (collectionApi) {
    return collectionApi.getFilteredByGlob("posts/*.md");
  });
};

This will create a collection “posts” that contains all the markdown files in the posts folder.