Sharing variables with Jade templates can be baffling at first. If you're coming form a Jekyll background you would expect that variables are available automatically in the template as well as the layout, but this is not the case.
This Jade layout and template illustrates the issue. In the template we declare a title variable that is only available to the template. This variables even though is being used in the layout, will result in a blank page title.
This issue occurs because Jade creates a new scope for each template and/or block it encounters. To get around this issue we simply need to place all markup in a root block then declare variables in this block in the template. All variables will be accessible to each scope that is a child of the of the scope the variables are declared in.
One thing to keep in mind though with this techniqe is that if the variable does not exist then Jade will throw an error when compiling.