11ty

Eleventy Documentation

This documentation is for an older version. Go to the newest Eleventy docs or check out the full release history.

Documentation Pages

Global Data Files #

Your global data folder is controlled by the dir.data configuration option. All json files in this directory will be parsed into a global data object available to all templates.

If a data file is in a subdirectory, the subdirectory structure will inform your global data object structure. For example, consider _data/users/userList.json with the following data:

[
"user1",
"user2",
"user3",
]

This data will be available to your templates like so:

{
users: {
userList: [
"user1",
"user2",
"user3",
]
}
}