Reputation: 48477
I'm stuck with this problem. When I use Markdown + Nunjucks as explained in the metalsmith-in-place Wiki the output is wrong (see below).
The default layout, note the safe
filter (_layouts/base.njk
):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{{title}}</title>
</head>
<body>
{{ contents | safe }}
</body>
The template that is using Markdown + Nunjucks (about.md.njk
):
---
title: About
layout: base.njk
---
# {{ title }}
Output:
<p><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>About</title>
</head>
<body></p>
<h1>About</h1>
<p> </body>
</html></p>
Upvotes: 0
Views: 114
Reputation: 48477
Solved right after posting the question. This may be help, the problem is the order of plugins in my build.js
:
Metalsmith(__dirname)
.source('./contents')
.destination('./build')
.clean(true)
.use(inPlace()) // inPlace must come BEFORE layouts!
.use(layouts({
directory: '_layouts',
default: 'base.njk'
}))
.build(function(err) {
if (err) throw err;
});
Upvotes: 1