1

Sorry if this is a really obvious question, I'm new to Twig and Craft. I'm getting the following error: Unexpected tag name "offset" (expecting closing tag for the "if" tag defined near line 54)

Can anyone tell me what is wrong with my code?

<div class="box alt container">
{% set offset = true %}
{% if offset %}
<section class="feature left">
    {% set caseHero = entry.heroImage.first() %}
    <a href="#" class="image icon fa-signal"><img src='{{caseHero.url}}' alt="" /></a>
    <div class="content">
        <h3>{{entry.title}}</h3>
        <p>{{entry.description}}</p>
    </div>
</section>
    {% offset = false %}
{% else %}
<section class="feature left">
    {% set caseHero = entry.heroImage.first() %}
    <a href="#" class="image icon fa-signal"><img src='{{caseHero.url}}' alt="" /></a>
    <div class="content">
        <h3>{{entry.title}}</h3>
        <p>{{entry.description}}</p>
    </div>
</section>
    {% offset = true %}
{% endif %}

2 Answers 2

2

It seems like you want to set offset to false after your first section.

To do this correctly you would need to use set like this:

{% set offset = false %}

Checkout the documentation to set a variable

1

The problem line is this one:

{% offset = true %}

It needs to be:

{% set offset = true %}

I think there are a couple of occurrences.

2
  • Sorry, I've just realised that the answer above says the same thing. Mark his as the correct answer if you agree. Apr 6, 2016 at 14:22
  • Thanks, yes there were two occurrences thank you
    – Ross
    Apr 6, 2016 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.