{% macro render_menu(items, child) %}
    {% import _self as macros %}
    {# if child is true output set to childMenu   #}
    {% if child == true %}
        {% set menuClass = "childMenu" %}
        {% set menuItemClass = "childMenu__item" %}
        {% set menuLinkClass = "childMenu__link" %}
    {% else %}
        {% set menuClass = "siteMenu" %}
        {% set menuItemClass = "siteMenu__item" %}
        {% set menuLinkClass = "siteMenu__link" %}
    {% endif %}

    <ul class="{{ menuClass }}">
        {% for item in items %}
            {% if item.published %}
                <li class="{{ menuItemClass }}">
                    {% if item.category == "menu" %}
                        <h4 class="siteMenu__heading">{{ item.name }}</h4>
                    {% else %}
                        <a class="{{ menuLinkClass }}" href="{{ item.url }}" target="{{ item.target }}">{{ item.name }}</a>
                    {% endif %}

                    {# Recursively render children if they exist #}
                    {% if item.children is defined and item.children | length %}
                        {{ macros.render_menu(item.children, true) }}
                    {% endif %}
                </li>
            {% endif %}
        {% endfor %}
    </ul>
{% endmacro %}
