[solved] Embedding an if in a range

The following partial:

<nav class="nav has-shadow">
    <div class="nav-left">
        <a class="nav-item" href="/">
            <strong>roidelapluie</strong>
        </a>
        {{ range $caption, $types := .Site.Data.misc.menu }}
        <a class="nav-item is-tab" href="/">
            {{ $caption }}
        </a>
            {{ if in $types .Type }} is-active{{ end }}
        {{ end }}
        <a class="nav-item is-tab" href="/">
        </a>
        <a class="nav-item is-tab" href="/">
        </a>
    </div>
</nav>

is not working:

ERROR: 2017/01/17 21:01:15 general.go:236: theme/partials/menu.html is an incomplete or empty template

It works when I remove {{ if in $types .Type }} is-active{{ end }}.

What is wrong then? That if is closed.

Changing .Type by $.Type fixed it.

Similar to https://discuss.gohugo.io/t/solved-help-using-range/5155/2