Set custom page variables?


Is there any way to set custom page variables in stackedit? The use case is that I want to add specific body tag classes to different files upon publication.

Here’s my attempt that didn’t work:

within File Properties > YAML Properties:

body-class: post
  preset: ‘’

And within the the Stackedit template:

<body class=“stackedit {{files.0.body-class}} test>

I also tried this in the Stackedit template:

<body class=“stackedit {{page.body-class}} test”>

But the body-class didn’t appear in stackedit’s html output.


Right, I should have mentioned this in my other post, especially considering I was initially confused by the same thing.

All YAML properties are accessible under, both “standard” ones like extensions, and arbitrary custom ones like body-class.

So your example should look something more like this:

<body class="stackedit {{}} test">

Yeesh, that’s a lot to type. Ah well.


Thanks, I’ll try that.

I searched for YAML documentation on this and couldn’t find anything. The standard stackedit html template uses <title>{{}}</title> so I figured custom properties would be at the same level in the hierarchy, but I guess .name is literally the file name rather than a property defined within it.

There’s probably lots of stuff I could do with stackedit that I’ll never know about because the documentation is so limited.