- Why Eleventy?
- Getting Started
- Using Data
- API Services
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):
- Computed Data
- Front Matter Data in a Template
- Template Data Files
- Directory Data Files (and ascending Parent Directories)
- Front Matter Data in Layouts (this moved in 1.0)
- Configuration API Global Data
- Global Data Files
Community Resources Jump to heading
Example Jump to heading
title: This is a Good Blog Post
title: This is a Very Good Blog Post
Note that when
my-layout.njk share data with the same object key (
tags), the “leaf template”
my-template.md takes precedence.
The data cascade results in the following data when
my-template.md is rendered:
"title": "This is a Good Blog Post",
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.