Stand with Ukraine 🇺🇦
The possum is Eleventy’s mascot
Eleventy Documentation
Eleventy 1.93s
Astro 22.90s

Global Data from the Configuration API Added in v1.0.0


In addition to Global Data Files global data can be added to the Eleventy config object using the addGlobalData method. This is especially useful for plugins.

The first value of addGlobalData is the key that will be available to your templates and the second value is the value of the value returned to the template.

Example Jump to heading

module.exports = function (eleventyConfig) {
// Values can be static:
eleventyConfig.addGlobalData("myStatic", "static");
// functions:
eleventyConfig.addGlobalData("myFunction", () => new Date());
// or a promise:
() => {
return new Promise((resolve) => {
setTimeout(resolve, 100, "foo");
// or async:
async () => {
return Promise.resolve("hi");

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

Other pages in Data Cascade: