I'm trying to pass the title
variable into the head
section of the _layout.pug
file. i can't see any way to achieve this neatly so have had to resort to pre-pending variables to the block:
//- _layout.pug
html
head
block headStuff
title #{title}
//- main.pug
extends _layout
prepend headStuff
-var title = 'The Positioning Schema'
Am I attacking this the wrong way? Should this be a mixin?
Normally, things like the title would be passed through as variables from whatever back end it's hooked up to (node, usually for me). If you're just using it to compile straight to static HTML without a back end, though, you should just be able to pass it to the layout in
block head
layout.pug
main.pug