I'm using Underscore's templating engine for my Metalsmith website and I'm having a bit of a trouble accessing the footer
partial. I'm receiving an error message saying:
ReferenceError: footer is not defined
How should I call it? What am I doing wrong?
Thank you.
Here's the templating part of my Metalsmith build file:
...
.use(layouts({
engine: 'underscore',
directory: 'templates',
partials: 'templates/partials'
}))
Here's my folder structure:
posts/
src/
templates/
- base.tpl.html
- partials/
-- footer.tpl.html
Here's a post example:
---
title: My First Post
date: 2012-08-20
layout: base.tpl.html
---
# This is my title
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur sed magna vel eros malesuada fringilla.
And here's my html page:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><%- sitename %></title>
</head>
<body>
<h1>Hello, world!</h1>
<%= contents %>
<% footer %> <---- THIS IS UNDEFINED
</body>
</html>