Pass variables to base layout from extending pug/jade template

Ah ha! Figured it out.

Create a block at the top of the base layout and add your variables in there.

_layout.jade:

block variables
doctype html
html(lang="en-au")
    head
        meta(charset="utf-8")
        block css
    body(class=(body_class || "it-did-not-work"))
        block header
        block content
        block footer

home.jade:

extends _layout
block variables
    - var body_class="i-am-the-home-page"
block header
    h1 home

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)