{% extends 'default/base-index.html.twig' %}
{% do script(['app/js/index/index.js']) %}

{% block content %}
    {% cache 'jianmo/home/top/banner' 600 %}
    {{ block_show('jianmo:home_top_banner') }}
    {% endcache %}
    {% for config in themeConfig.blocks.left|default([]) %}
        {% set code = config.code %}
        {% if config.sortName|default('') == 'recommended' and code == 'category-course' %}
            {% set code = 'recommend-course' %}
        {% endif %}
        {% set isPlugin = config.isPlugin|default(0) %}

        {% set category = config.categoryId|default(0) ? data('Category', {categoryId: config.categoryId})  : null %}

        {% if isPlugin and is_plugin_installed(config.pluginName) %}
          {% include config.show with {config:config, category: category} %}
        {% elseif not isPlugin %}
          {% if code == 'friend-link' %}
              {% include 'default/' ~ code ~ '.html.twig' with {friendlyLinks:friendlyLinks} %}
          {% elseif code != 'footer-link' %}
              {% if code != 'course-grid-with-condition-index' %}
                  {% cache 'jianmo/default/' ~ code 600 %}
                  {% include 'default/' ~ code ~ '.html.twig' with {config:config, category: category} %}
                  {% endcache %}
              {% else %}
                  {% include 'default/' ~ code ~ '.html.twig' with {config:config, category: category} %}
              {% endif %}
          {% endif %}
        {% endif %}
        
    {% endfor %}
{% endblock %}