Global data
Templates are provided with data when they render. To use the same global data across all of the templates in your project, point to an entry file in your Night Owl configuration.
export default {
// The location of your global data file
data: "src/_data/index.js",
}
Anything that is set in your global data is then available to every template when it renders. For example, you could provide a creation date in your global data to use on the footer of every page.
export default {
created: new Date()
}
Merging data
Data can be set by pages, templates, layouts and in the global data file. Night Owl uses deep merging when combining the different levels of data.
If the same properties are defined at different levels, the page data has the highest precedence, followed by the template, the layout and finally the global data file.
Special properties
Some data changes the way Night Owl handles your template. For this reason, it’s best to avoid using them in your global data to avoid unexpected results. Read more about a template’s special properties.
The only exception to this rule is the layout
property, which can be used to set a default layout for every template that generates a HTML page.