Skip to navigation Skip to main content
11ty Logo Sustainability Fundraising
Eleventy Documentation
Toggle Menu
Eleventy 1.93s
Astro 22.90s

The Data Cascade


In Eleventy, data is merged from multiple different sources before the template is rendered. The data is merged in what Eleventy calls the Data Cascade.

Sources of Data Jump to heading

When the data is merged in the Eleventy Data Cascade, the order of priority for sources of data is (from highest priority to lowest):

  1. Computed Data
  2. Front Matter Data in a Template
  3. Template Data Files
  4. Directory Data Files (and ascending Parent Directories)
  5. Front Matter Data in Layouts (this moved in 1.0)
  6. Configuration API Global Data
  7. Global Data Files

Example Jump to heading

title: This is a Good Blog Post
layout: my-layout.njk
Filename _includes/my-layout.njk
title: This is a Very Good Blog Post
author: Zach
- JavaScript

Note that when and my-layout.njk share data with the same object key (title and tags), the “leaf template” takes precedence.

The data cascade results in the following data when is rendered:

Syntax JavaScript
"title": "This is a Good Blog Post",
"author": "Zach",
"tags": ["CSS", "HTML", "JavaScript"],
"layout": "my-layout.njk"

By default in v1.0, Eleventy does a deep data merge to combine Object literals and Arrays. If you want to opt-out of this behavior and revert to a simple top level merge (Object.assign) from the different data sources, you can turn off Data Deep Merge. You can override this on a per-property basis too—read more at the Data Deep Merge documentation.

From the Community Jump to heading

×39 resources courtesy of curated by IndieWeb Avatar for Monsour

Expand to see 34 more resources.

Other pages in Using Data: