{% 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 %}
        <div class="g-content{{ segment.classes ? ' ' ~ segment.classes|join(' ')|e }}">
            {{ html|raw }}
        </div>
    {% endif %}

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