简体   繁体   中英

Template render error

I'm using nunjucks to render some variables:

    <div class="zoomable zoomable-{{ slide.index }}"> << this works

        {% if slide.temp is none %} << this doesn't
            {% include "layouts/"+{{slide.layout}} %} << this doesn't
        {% endif %}

    </div>

When the JS calls nunjucks.render, I get the following error:

parseAggregate: expected colon after dict key on the include

There are two issues with this:

  • It's not supposed to skip the condition, because the property temp doesn't exist.
  • Is it not letting me access the slide properties? Because slide.layout is valid

Am I doing something wrong?

我认为您只需要删除curly brackets

{% include "layouts/" + slide.layout %}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM