Skip to navigation Skip to main content
Eleventy
Eleventy Documentation
Stable
2.0.1
Toggle Menu
Eleventy 5.81s
Remix 40.14s

Order of Operations

From a very high level, Eleventy’s internal order of operations is such:

  1. Find any file matching a valid Eleventy file extension in the Input directory (e.g. ./src/**.njk or ./docs/**.md).
  2. Iterate over the files.
    • If it doesn’t match a template file extension, treat it as a passthrough copy.
    • If it does match a template file extension, continue processing as an Eleventy template.
  3. Start the asynchronous copy of passthrough copy. This includes files specified via passthrough copy in Eleventy’s configuration and files with non-template-matching file extensions. This will continue in parallel while templates are being processed.
  4. Initial Data Cascade is generated for each template file. This includes all values from front matter, layouts, directory and file data files, and global data.
    • The data cascade does not yet include populated collections, templateContent, or computed page values (e.g. page.url and page.outputPath).
  5. A dependency graph of the templates is created to process them in the correct order.
    • This is a bit oversimplified and some may mix-and-match, if they aren’t dependent on each other. From a high level, the templates are processed like this (listed here in reverse order1 is processed first):
      1. Templates that use Pagination and target collections.all
      2. Templates that use Pagination and target collections
      3. Templates that use Pagination and target a Configuration API-added collection
      4. Templates that use Pagination and target any other Collection (those supplied via tags)
      5. Templates that have tags specified
      6. Templates that have no dependencies or who are excluded via eleventyExcludeFromCollections
    • Note: Eleventy does not automatically know what data is used inside of template content at this stage. Eleventy uses front matter to determine which templates supply collections, and which templates consume collections. (For a safety net, you can use eleventyImport in front matter option to declare dependencies manually.)
  6. Collections are generated in the correct order, per the dependency graph.
  7. Additional Data Cascade operations are applied:
  8. Templates are rendered (templateContent is generated) in the order generated by the dependency graph without layouts applied.
    • Per the above Note, if one template uses another template’s templateContent before it has been generated, we defer the first template to render in a second pass.
    • After all templateContents have been rendered, they are copied into the appropriate collections’ objects. (Remember: at this point templateContent in collections still do not include layouts.)
  9. Eleventy checks for duplicate permalinks and throws an error if more than one template attempts to write to the same output file.
  10. Layouts are applied to templates. The previously generated templateContent values (without layouts) are re-used here.
  11. The content is written to files on disk.