I’d like to use front matter in Stackedit markdown files so that I can set custom variables to use in Stackedit’s handlebar template. The use case is that I want to add specific classes to different files upon publication.
Here’s my test stackedit markdown file:
---
body-class: post
---
test demo content
Here’s my stackedit template:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{{files.0.name}}</title>
</head>
<body class="stackedit {{files.0.body-class}} test">
{{{files.0.content.html}}}
</body>
</html>
Here’s the resulting html output that stackedit publishes:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>front-matter-test</title>
</head>
<body class="stackedit test">
<hr>
<h2 id="body-class-post">body-class: post</h2>
<p>test demo contents</p>
</body>
</html>
Is there anything I do to make stackedit recognize the front matter?