Server Side Variable Interpolation with Pug

Tutorial Difficulty Level    

It’s possible to pass variables from your server into Pug for dynamic content or script generation. Pug templates can access variables passed to the res.renderfunction in Express (or pug.renderFile if you are not using Express, the arguments are identical).

Inside your index.pug file, you then have access to the locals variable by way of its keys. The names of the variables in your Pug file become siteColors and siteNames.

To set the entirety of an HTML element equal to a variable, use the equals operator = to do so. If your variable needs to be embedded inline, use bracket syntax #{} to do so.