Eleventy: Global vs Directory Data Override Confusion
0 reputation · 31 Oct 2023, 23:35 UTC
Data Cascade Priority Issue
Eleventy resolves template data through a hierarchical cascade: front matter overrides directory data, which in turn overrides global data from the _data folder. When a global data file and a directory‑specific data file share identical keys, the expected precedence is deterministic, but real projects sometimes observe unexpected overrides, especially in deeply nested structures.
The goal is to confirm whether Eleventy’s documented cascade guarantees that a directory‑level site.json will always supersede _data/site.json for templates within that folder, and whether any edge cases exist when multiple directories contain the same key.
Additionally, I want to understand the performance impact: does Eleventy re‑process a large global data file for every template, or does it cache the data across the build?
Questions:
- Does Eleventy’s data cascade deterministically prioritize directory data over global data when key collisions occur?
- Are there documented exceptions or configuration options that alter this priority?
- How does Eleventy handle large global data files in terms of build time and memory usage?