Eleventy Recipes Wordmark

Eleventy Recipes

Add global data

By Mike Aparicio

Global data files allow you to store data in a single file and reference it in all of your templates. It can be handy for adding meta data about the site to various pages, but has lots of other uses as well.


  1. Add a folder called _data

  2. Within _data/, create a file called site.json

  3. In site.json add some details about your site

"name": "11ty Recipes",
"url": "https://11ty.recipes",
"authorName": "Mike Aparicio",
"authorUrl": "https://mikeaparicio.com",
"description": "11ty.recipes helps you build an Eleventy site from scratch, showing you how to add individual features to craft the exact site you need.",
"favicon": "https://11ty.recipes/images/meta/favicon.svg"
  1. You can access this data in your templates using template variables
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="{{ site.authorName }}">
<meta name="description" content="{{ site.description }}">
<link rel="icon" href="{{ site.favicon }}" type="image/svg+xml" />