模板渲染错误

Template render error

我正在使用 nunjucks 渲染一些变量:

    <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>

当JS调用nunjucks.render时,出现如下错误:

parseAggregate: expected colon after dict keyinclude

这有两个问题:

我是不是做错了什么?

我认为您只需要删除 curly brackets

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