{% if not level %}
  {% set level=0 %}
{% endif %}
{% if not menu %}
  {% set menu=context.settings.MENU.main %}
{% endif %}
{% if is_dict(menu) %}
  {% set menu=menu.main %}
{% endif %}
{% for name, item in menu %}
  {% if is_list(item) %}
    <li class="dropdown">
      <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ name }}</a>
      <ul class="dropdown-menu">
        {% with menu=item, level=level+1 %}
          {% include "simple_menu/bootstrap3.html" %}
        {% endwith %}
      </ul>
    </li>
  {% else %}
    <li><a href="{{ item.url }}">{{ name }}</a></li>
  {% endif %}
{% endfor %}
