Category : jinja2

I’d like to pass a background-image as a parameter in Jinja macro. I got something working without parameterised like this: {% macro pm_card() %} <div style="background-image: url(../static/images/hm_bg.jpg)" class=’card-img-top’></div> {% endmacro %} I can’t seem to do this: {% macro pm_card(bg) %} <div style="background-image: {{bg}}" class=’card-img-top’></div> {% endmacro %} then pass bg this way: {{pm_card(‘../static/images/hm_portrait.jpg’)}} How ..

Read more