Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 358
amigo21 Avatar asked Jun 19 '26 01:06

amigo21


1 Answers

I think you just need to remove the curly brackets i.e.

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

like image 103
theleebriggs Avatar answered Jun 21 '26 16:06

theleebriggs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!