Globals
Globals is JSON data stored in your harp.json
file that is available to all pages, templates, partials and layouts.
Why?
Harp isn’t just about static assets, pages can be created using dynamic content too. Adding content to the globals
property will be natively available.
harp.json
{
"globals": {
"title": "Acme Site",
"name" : "John Doe",
"uri": "http://example.com"
}
}
Jade Example
index.jade
html
head
title #{ title }
body
h1 Hello #{ name }!
EJS Example
index.ejs
<html>
<head>
<title><%= title %></title>
</head>
<body>
<h1>Hello <%= name %>!</h1>
</body>
</html>