Doing my first site with Craft and UiKit framework I encountered a small problem with dropdown menu. Here is my code:
<ul>
{% set entries = craft.entries.section('spb') %}
{% nav entry in entries %}
<li class="uk-parent" data-uk-dropdown>
<a {% if craft.request.getPath() == entry.uri %} class="active" {% endif %} href="{{ entry.url }}">{{ entry.title }}</a>
{% ifchildren %}
<div class="uk-dropdown">
<ul class="uk-nav uk-nav-dropdown">
{% children %}
</ul>
</div>
{% endifchildren %}
</li>
{% endnav %}
</ul>
The point is that my child element looks exactly like parent because it takes its structure. But I don't need neither "class" nor "data-uk-dropdown" element...
<li class="uk-parent" data-uk-dropdown=""><a href="#">...</a></li>
Is there any workaround? Thanks.
{% set liTagAttributes = entry.level == 1 ? 'class=uk-parent data-uk-dropdown' : 'class=uk-child' %}– Stanislav Ulver Dec 18 '14 at 09:27""...""– Stanislav Ulver Dec 18 '14 at 09:37rawfilter to the output. This makes Twig to not escape the code and you end up with single quotes. I definitely don't recommend to use attribute value without quotes at all. – carlcs Dec 18 '14 at 09:43