Liquid if statement error

The menu.yml file is similar to the one in the Navigation document apart from the fact that I have added an nd item to control the displaying of the title as I don’t want the title on the first item

This is the html in the include file:

<div class="menu">
{% for item in site.data.menu.toc %}
{% if item.nd = true}
<h3>{{ item.title }}</h3>
{% endif %}
{% for entry in item.subfolderitems %}
<a href="{{ entry.url }}">{{ entry.page }}</a>
{% endfor %}
</div>

I am always getting the following from Jekyll when rebuilding…

Liquid Exception: Liquid syntax error (/home/martin/jeykll/prototype/_includes/menu.html line 18): 'if' tag was never closed included in /_layouts/default.html
Error: Liquid syntax error (/home/martin/jeykll/prototype/_includes/menu.html line 18): 'if' tag was never closed included

I’m not sure what the problem is and where the actual error is. AFAIK there are enough end loops…

Realised I had structured the yml wrong, changed that but it still won’t work…

Full code is on Github at https://github.com/martinjh99/jekyllsite

Anyone got any ideas?

you are missing an endfor I think - you have two for loops but only one is closed…

You’re missing a %, should be:

{% if item.nd = true %}
1 Like