{% try %}
    {% if not particle %}
        {% set enabled = gantry.config.get('particles.' ~ segment.type ~ '.enabled', 1) %}
        {% set particle = gantry.config.getJoined('particles.' ~ segment.type, segment.attributes) %}
    {% endif %}

    {% set html %}
        {% if enabled and (segment.attributes.enabled is null or segment.attributes.enabled) %}
            {% include ['particles/' ~ segment.subtype|default('position') ~ '.html.twig',
            '@particles/' ~ segment.subtype|default('position') ~ '.html.twig'] %}
        {% endif %}
    {% endset %}

    {%- if html|trim %}
        {% if gantry.debug and segment.attributes.key %}<!-- START POSITION {{ segment.attributes.key }} -->{% endif %}

        <div class="g-content{{ segment.classes ? ' ' ~ segment.classes|join(' ')|e }}">
            {{ html|raw }}
        </div>
        {% if gantry.debug and segment.attributes.key %}<!-- END POSITION {{ segment.attributes.key }} -->{% endif %}
    {% endif %}

{% catch %}
    <div class="alert alert-error"><strong>Error</strong> while rendering {{ segment.subtype|default('position') }}.</div>
{% endtry %}
