I have a settings page called posting.pug and it extends a pug settingsLayout template.
Where are several settings pages in my app. And I want to pass a variable posting=1 to the settingsLayout page to show a user that the posting page is the current.
How should I pass a variable to the template I extend?
I tried to set a variable before extends. That's not allowed.
I tried passing it as an attribute -- doesn't work.
You can try like this
settingsLayout.pug
block variables
doctype html
html
head
body
// Try to call variable here
h1 posting
posting.pug
extends settingsLayout
block variables
- var posting = 1
I hope this work!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With