Collections

Every sub-folder in the collections/ folder automaticaly becomes a collection.

You can override the auto-collections feature as you wish with project-specific collections.

Any JavaScript file inside your input folder's subfolder _11ty/collections/ with exports will create collections with the export's names.

For example, if you want a some_pages collection for Markdown files inside a /pages/sub_folder/ folder (files in the pages/ subfolder are not in collections by default), create an _11ty/collections/my_own_pages_collection.js with this content:

module.exports = {
  some_pages: (collection) => collection.getFilteredByGlob('src/pages/sub_folder/**/index.md'),
};

The name of the export becomes the name of the collection. The name of the JavaScript file has no impact, but it must be in the _11ty/collections/ folder.

Collections with these names will not be replaced with auto-collections.

Any layout property set directly in a content's Front Matter will not be overriden by the global ones here after.

If the content comes from one of the collections and a layout exists with the same name as the collection, it is used. The pages layout is used as a fallback.

Examples if there are news and notes layouts:

sourcelayout
pages/index.mdpages
pages/about.mdpages
pages/about/index.mdpages
pages/about/other.mdpages
collections/news/index.mdnews
collections/news/first-article.mdnews
collections/news/2020/04/first-article/index.mdnews
collections/notes/2020/0001/first-note.mdnotes

Any permalink property set directly in a content's Front Matter will not be overriden by the default one here after:

sourcepermalink
index.mdindex.html
about.mdabout/index.html ⚠︎
about/index.mdabout/index.html ⚠︎
about/about.mdabout/index.html ⚠︎
about/other.mdabout/other/index.html
articles/2020/04/first-article/index.mdarticles/2020/04/first-article/index.html

As you can see, you can't have both /about.md and either /about/index.md or /about/about.md in sources with Eleventy default permalink behavior, as they would try to create the same HTML file.

WIP

WIP