


<div {% render 'section-attr' %}>
  {% render 'section-bg-image' %}
  <xo-container {% render 'section-layout' %}>
    {% case section.settings.blog_layout %}
      {% when 'left_sidebar' %}
        {% assign sidebar_style = '--order-lg: -1' %}
        {% assign mainblog_columns = '9' %}
      {% when 'right_sidebar' %}
        {% assign sidebar_style = '--order-lg: 0' %}
        {% assign mainblog_columns = '9' %}
      {% else %}
        {% assign sidebar_style = 'display: none' %}
        {% assign mainblog_columns = '12' %}
    {% endcase %}
    <xo-grid>
      <div style='--xs: 12; --md: 12; --lg: {{ mainblog_columns }}'>
        {% if section.settings.article_loadtype == 'paginate' %}
          {%- paginate blog.articles by section.settings.articles_per_page -%}
            {% case section.settings.blog_style %}
              {% when 'list' %}
                <div class='main-blog__list-layout'>
                  {%- for article in blog.articles -%}
                    {%- assign placeholder_image_index = forloop.index0 | modulo: 4 | plus: 1 -%}
                    {%- assign placeholder_image = 'product-apparel-' | append: placeholder_image_index -%}
                    {% render 'article-card-style4',
                      article: article,
                      media_aspect_ratio: '4/3',
                      show_image: section.settings.article_card_show_image,
                      show_date: section.settings.article_card_show_date,
                      show_excerpt: section.settings.article_card_show_excerpt,
                      placeholder_image: placeholder_image,
                      color_scheme: section.settings.article_card_color_scheme
                    %}
                  {% endfor %}
                </div>
              {% when 'masonry' %}
                <xo-masonry
                  xo-column='{{ section.settings.columns_desktop }}'
                  xo-breakpoints='
                    {
                      575: {
                        column: 1
                      },
                      768: {
                        column: {{ section.settings.columns_desktop | minus: 1 }}
                      }
                    }
                  '
                >
                  {%- for article in blog.articles -%}
                    {%- assign placeholder_image_index = forloop.index0 | modulo: 4 | plus: 1 -%}
                    {%- assign placeholder_image = 'product-apparel-' | append: placeholder_image_index -%}
                    <xo-masonry-item class='masonry__item'>
                      {% render 'article-card-style1',
                        article: article,
                        show_image: section.settings.article_card_show_image,
                        show_date: section.settings.article_card_show_date,
                        show_excerpt: section.settings.article_card_show_excerpt,
                        placeholder_image: placeholder_image,
                        color_scheme: section.settings.article_card_color_scheme
                      %}
                    </xo-masonry-item>
                  {% endfor %}
                </xo-masonry>
              {% else %}
                <xo-grid style='--lg: {{ section.settings.columns_desktop }}; --md: {{ section.settings.columns_desktop | minus: 1 }}; --xs: 1;'>
                  {%- for article in blog.articles -%}
                    {%- assign placeholder_image_index = forloop.index0 | modulo: 4 | plus: 1 -%}
                    {%- assign placeholder_image = 'product-apparel-' | append: placeholder_image_index -%}
                    {% render 'article-card-style1',
                      article: article,
                      media_aspect_ratio: '4/3',
                      show_image: section.settings.article_card_show_image,
                      show_date: section.settings.article_card_show_date,
                      show_excerpt: section.settings.article_card_show_excerpt,
                      placeholder_image: placeholder_image,
                      color_scheme: section.settings.article_card_color_scheme
                    %}
                  {% endfor %}
                </xo-grid>
            {% endcase %}
            {%- render 'pagination', paginate: paginate -%}
          {%- endpaginate -%}
        {% else %}
          {% case section.settings.blog_style %}
            {% when 'list' %}
              <div class='main-blog__list-layout'>
                {%- for article in blog.articles -%}
                  {%- assign placeholder_image_index = forloop.index0 | modulo: 4 | plus: 1 -%}
                  {%- assign placeholder_image = 'product-apparel-' | append: placeholder_image_index -%}
                  {% render 'article-card-style4',
                    article: article,
                    media_aspect_ratio: '4/3',
                    show_image: section.settings.article_card_show_image,
                    show_date: section.settings.article_card_show_date,
                    show_excerpt: section.settings.article_card_show_excerpt,
                    placeholder_image: placeholder_image,
                    color_scheme: section.settings.article_card_color_scheme
                  %}
                {% endfor %}
              </div>
            {% when 'masonry' %}
              <xo-masonry
                xo-column='{{ section.settings.columns_desktop }}'
                xo-breakpoints='
                  {
                    575: {
                      column: 1
                    },
                    768: {
                      column: {{ section.settings.columns_desktop | minus: 1 }}
                    }
                  }
                '
              >
                {%- for article in blog.articles -%}
                  {%- assign placeholder_image_index = forloop.index0 | modulo: 4 | plus: 1 -%}
                  {%- assign placeholder_image = 'product-apparel-' | append: placeholder_image_index -%}
                  <xo-masonry-item class='masonry__item'>
                    {% render 'article-card-style1',
                      article: article,
                      show_image: section.settings.article_card_show_image,
                      show_date: section.settings.article_card_show_date,
                      show_excerpt: section.settings.article_card_show_excerpt,
                      placeholder_image: placeholder_image,
                      color_scheme: section.settings.article_card_color_scheme
                    %}
                  </xo-masonry-item>
                {% endfor %}
              </xo-masonry>
            {% else %}
              <xo-grid style='--lg: {{ section.settings.columns_desktop }}; --md: {{ section.settings.columns_desktop | minus: 1 }}; --xs: 1;'>
                {%- for article in blog.articles -%}
                  {%- assign placeholder_image_index = forloop.index0 | modulo: 4 | plus: 1 -%}
                  {%- assign placeholder_image = 'product-apparel-' | append: placeholder_image_index -%}
                  {% render 'article-card-style1',
                    article: article,
                    media_aspect_ratio: '4/3',
                    show_image: section.settings.article_card_show_image,
                    show_date: section.settings.article_card_show_date,
                    show_excerpt: section.settings.article_card_show_excerpt,
                    placeholder_image: placeholder_image,
                    color_scheme: section.settings.article_card_color_scheme
                  %}
                {% endfor %}
              </xo-grid>
          {% endcase %}
        {% endif %}
      </div>
      <div style='--xs: 12; --md: 12; --lg: 3; {{ sidebar_style }}'>
        <div class='main-blog__sidebar-wrap'>
          {% if section.settings.enable_category %}
            <div class='main-blog__category'>
              <xo-animate xo-cascade>
                <h2 class='main-blog__title'>{{ section.settings.category_title }}</h2>
              </xo-animate>
              <ul role='list' class='main-blog__category-list'>
                {% for link in section.settings.category.links %}
                  <xo-animate xo-cascade>
                    <li class='main-blog__category-item'>{{ link.title | escape | link_to: link.url }}</li>
                  </xo-animate>
                {% endfor %}
              </ul>
            </div>
          {% endif %}
          {% if section.settings.enable_post %}
            <div class='main-blog__post'>
              <xo-animate xo-cascade>
                <h2 class='main-blog__title'>{{ section.settings.post_title }}</h2>
              </xo-animate>
              {% for article in section.settings.post.articles limit: section.settings.post_limit %}
                {%- assign placeholder_image_index = forloop.index0 | modulo: 4 | plus: 1 -%}
                {%- assign placeholder_image = 'product-apparel-' | append: placeholder_image_index -%}
                {% render 'article-card-style3', article: article, media_aspect_ratio: '1/1', show_image: true, show_date: true, placeholder_image: placeholder_image %}
              {% endfor %}
            </div>
          {% endif %}
          {% if section.settings.enable_tag %}
            {% assign unique_tag = blog.all_tags | uniq %}
            <div class='main-blog__tag'>
              <xo-animate xo-cascade>
                <h2 class='main-blog__title'>{{ section.settings.tag_title }}</h2>
              </xo-animate>
              <ul role='list' class='main-blog__tag-list'>
                {% for tag in unique_tag %}
                  <xo-animate xo-cascade>
                    {%- if current_tags contains tag -%}
                      <li class='main-blog__tag-item xo-active'>{{ tag }}</li>
                    {%- else -%}
                      <li class='main-blog__tag-item'>{{ tag | link_to_tag: tag }}</li>
                    {%- endif -%}
                  </xo-animate>
                {% endfor %}
              </ul>
            </div>
          {% endif %}
          {% if section.settings.enable_banner %}
            <xo-animate xo-cascade class='main-blog__banner'>
              <a
                href='
                  {%- if section.settings.banner_link != blank -%}
                    {{section.settings.banner_link}} {%- else -%}
                    https://shopify.pxf.io/9gPaY0
                  {%- endif -%}
                '
              >
                {%- if section.settings.banner_image != blank -%}
                  {% render 'image', image: section.settings.banner_image %}
                {%- else -%}
                  <img src='https://landing.shopilaunch.com/starter/sidebar_banner.jpg' width='1200' height='800' alt='affiliate' is='xo-lazyload' loading='lazy'>
                {%- endif -%}
              </a>
            </xo-animate>
          {% endif %}
        </div>
      </div>
    </xo-grid>
  </xo-container>
</div>

{% schema %}
{
  "name": "t:sections.main_blog.name",
  "tag": "section",
  "class": "section",
  "settings": [
    {
      "type": "select",
      "id": "width",
      "label": "t:sections.main_blog.settings.width.label",
      "options": [
        {
          "value": "box",
          "label": "t:sections.main_blog.settings.width.option_1.label"
        },
        {
          "value": "wide",
          "label": "t:sections.main_blog.settings.width.option_2.label"
        }
      ],
      "default": "box"
    },
    {
      "type": "select",
      "id": "blog_layout",
      "label": "t:sections.main_blog.settings.blog_layout.label",
      "options": [
        {
          "value": "left_sidebar",
          "label": "t:sections.main_blog.settings.blog_layout.option_1.label"
        },
        {
          "value": "right_sidebar",
          "label": "t:sections.main_blog.settings.blog_layout.option_2.label"
        },
        {
          "value": "without_sidebar",
          "label": "t:sections.main_blog.settings.blog_layout.option_3.label"
        }
      ],
      "default": "left_sidebar"
    },
    {
      "type": "select",
      "id": "blog_style",
      "label": "t:sections.main_blog.settings.blog_style.label",
      "options": [
        {
          "value": "list",
          "label": "t:sections.main_blog.settings.blog_style.option_1.label"
        },
        {
          "value": "grid",
          "label": "t:sections.main_blog.settings.blog_style.option_2.label"
        },
        {
          "value": "masonry",
          "label": "t:sections.main_blog.settings.blog_style.option_3.label"
        }
      ],
      "default": "grid"
    },
    {
      "type": "range",
      "id": "articles_per_page",
      "min": 8,
      "max": 24,
      "step": 1,
      "default": 10,
      "label": "t:sections.main_blog.settings.articles_per_page.label"
    },
    {
      "type": "range",
      "id": "columns_desktop",
      "min": 1,
      "max": 5,
      "step": 1,
      "default": 3,
      "label": "t:sections.main_blog.settings.columns_desktop.label"
    },
    {
      "type": "select",
      "id": "article_loadtype",
      "label": "t:sections.main_blog.settings.article_loadtype.label",
      "options": [
        {
          "value": "paginate",
          "label": "t:sections.main_blog.settings.article_loadtype.option_1.label"
        },
        {
          "value": "infinity",
          "label": "t:sections.main_blog.settings.article_loadtype.option_2.label"
        }
      ],
      "default": "paginate"
    },
    {
      "type": "header",
      "content": "t:sections.all.article_card_header.content"
    },
    {
      "type": "checkbox",
      "id": "article_card_show_image",
      "default": true,
      "label": "t:sections.all.article_card_show_image.label"
    },
    {
      "type": "checkbox",
      "id": "article_card_show_date",
      "default": true,
      "label": "t:sections.all.article_card_show_date.label"
    },
    {
      "type": "checkbox",
      "id": "article_card_show_excerpt",
      "default": false,
      "label": "t:sections.all.article_card_show_excerpt.label"
    },
    {
      "type": "color_scheme",
      "id": "article_card_color_scheme",
      "default": "scheme_1",
      "label": "t:sections.all.article_card_color_scheme.label"
    },
    {
      "type": "header",
      "content": "t:sections.main_blog.settings.sidebar_heading.content"
    },
    {
      "type": "header",
      "content": "t:sections.main_blog.settings.category_heading.content"
    },
    {
      "type": "checkbox",
      "id": "enable_category",
      "label": "t:sections.main_blog.settings.enable_category.label",
      "default": true
    },
    {
      "type": "text",
      "id": "category_title",
      "label": "t:sections.main_blog.settings.category_title.label",
      "default": "CATEGORIES"
    },
    {
      "type": "link_list",
      "id": "category",
      "label": "t:sections.main_blog.settings.category.label"
    },
    {
      "type": "header",
      "content": "t:sections.main_blog.settings.post_heading.content"
    },
    {
      "type": "checkbox",
      "id": "enable_post",
      "label": "t:sections.main_blog.settings.enable_post.label",
      "default": true
    },
    {
      "type": "text",
      "id": "post_title",
      "label": "t:sections.main_blog.settings.post_title.label",
      "default": "RECENT POSTS"
    },
    {
      "type": "blog",
      "id": "post",
      "label": "t:sections.main_blog.settings.post.label"
    },
    {
      "type": "range",
      "id": "post_limit",
      "min": 2,
      "max": 50,
      "step": 1,
      "label": "t:sections.main_blog.settings.post_limit.label",
      "default": 5
    },
    {
      "type": "header",
      "content": "t:sections.main_blog.settings.tag_heading.content"
    },
    {
      "type": "checkbox",
      "id": "enable_tag",
      "label": "t:sections.main_blog.settings.enable_tag.label",
      "default": true
    },
    {
      "type": "text",
      "id": "tag_title",
      "label": "t:sections.main_blog.settings.tag_title.label",
      "default": "TAGS"
    },
    {
      "type": "header",
      "content": "t:sections.main_blog.settings.banner_heading.content"
    },
    {
      "type": "checkbox",
      "id": "enable_banner",
      "label": "t:sections.main_blog.settings.enable_banner.label",
      "default": true
    },
    {
      "type": "image_picker",
      "id": "banner_image",
      "label": "t:sections.main_blog.settings.banner_image.label",
      "info": "t:sections.main_blog.settings.banner_image.content"
    },
    {
      "type": "url",
      "id": "banner_link",
      "label": "t:sections.main_blog.settings.banner_link.label"
    },
    {
      "type": "header",
      "content": "t:sections.all.heading.content"
    },
    {
      "type": "color_scheme",
      "id": "color_scheme",
      "label": "t:sections.all.color_scheme.label"
    },
    {
      "type": "select",
      "id": "background_type",
      "label": "t:sections.all.background_type.label",
      "options": [
        {
          "value": "color",
          "label": "t:sections.all.background_type.option__1.label"
        },
        {
          "value": "gradient",
          "label": "t:sections.all.background_type.option__2.label"
        },
        {
          "value": "image",
          "label": "t:sections.all.background_type.option__3.label"
        },
        {
          "value": "video",
          "label": "t:sections.all.background_type.option__4.label"
        }
      ],
      "default": "color"
    },
    {
      "type": "color",
      "id": "background_color",
      "label": "t:sections.all.background_color.label",
      "alpha": true,
      "visible_if": "{{ section.settings.background_type == 'color' }}"
    },
    {
      "type": "color_background",
      "id": "background_gradient",
      "label": "t:sections.all.background_gradient.label",
      "visible_if": "{{ section.settings.background_type == 'gradient' }}"
    },
    {
      "type": "image_picker",
      "id": "background_image_desktop",
      "label": "t:sections.all.background_image_desktop.label",
      "visible_if": "{{ section.settings.background_type == 'image' }}"
    },
    {
      "type": "image_picker",
      "id": "background_image_mobile",
      "label": "t:sections.all.background_image_mobile.label",
      "visible_if": "{{ section.settings.background_type == 'image' }}"
    },
    {
      "type": "checkbox",
      "id": "use_parallax",
      "label": "t:sections.all.use_parallax.label",
      "default": false,
      "visible_if": "{{ section.settings.background_type == 'image' }}"
    },
    {
      "type": "select",
      "id": "background_image_animation",
      "label": "t:sections.all.animation.label",
      "options": [
        {
          "value": "none",
          "label": "t:sections.all.animation.option__0.label"
        },
        {
          "value": "fade",
          "label": "t:sections.all.animation.option__1.label"
        },
        {
          "value": "fade-up",
          "label": "t:sections.all.animation.option__2.label"
        },
        {
          "value": "fade-down",
          "label": "t:sections.all.animation.option__3.label"
        },
        {
          "value": "fade-left",
          "label": "t:sections.all.animation.option__4.label"
        },
        {
          "value": "fade-right",
          "label": "t:sections.all.animation.option__5.label"
        },
        {
          "value": "zoom-in",
          "label": "t:sections.all.animation.option__6.label"
        },
        {
          "value": "zoom-out",
          "label": "t:sections.all.animation.option__7.label"
        },
        {
          "value": "rotate-left-up",
          "label": "t:sections.all.animation.option__8.label"
        },
        {
          "value": "rotate-right-up",
          "label": "t:sections.all.animation.option__9.label"
        },
        {
          "value": "snake-up",
          "label": "t:sections.all.animation.option__10.label"
        },
        {
          "value": "snake-down",
          "label": "t:sections.all.animation.option__11.label"
        },
        {
          "value": "snake-left",
          "label": "t:sections.all.animation.option__12.label"
        },
        {
          "value": "snake-right",
          "label": "t:sections.all.animation.option__13.label"
        },
        {
          "value": "3d-up",
          "label": "t:sections.all.animation.option__14.label"
        }
      ],
      "default": "none",
      "visible_if": "{{ section.settings.background_type == 'image' }}"
    },
    {
      "type": "textarea",
      "id": "background_video_url",
      "label": "t:sections.all.background_video_url.label",
      "visible_if": "{{ section.settings.background_type == 'video' }}"
    },
    {
      "type": "select",
      "id": "background_video_animation",
      "label": "t:sections.all.animation.label",
      "options": [
        {
          "value": "none",
          "label": "t:sections.all.animation.option__0.label"
        },
        {
          "value": "fade",
          "label": "t:sections.all.animation.option__1.label"
        },
        {
          "value": "fade-up",
          "label": "t:sections.all.animation.option__2.label"
        },
        {
          "value": "fade-down",
          "label": "t:sections.all.animation.option__3.label"
        },
        {
          "value": "fade-left",
          "label": "t:sections.all.animation.option__4.label"
        },
        {
          "value": "fade-right",
          "label": "t:sections.all.animation.option__5.label"
        },
        {
          "value": "zoom-in",
          "label": "t:sections.all.animation.option__6.label"
        },
        {
          "value": "zoom-out",
          "label": "t:sections.all.animation.option__7.label"
        },
        {
          "value": "rotate-left-up",
          "label": "t:sections.all.animation.option__8.label"
        },
        {
          "value": "rotate-right-up",
          "label": "t:sections.all.animation.option__9.label"
        },
        {
          "value": "snake-up",
          "label": "t:sections.all.animation.option__10.label"
        },
        {
          "value": "snake-down",
          "label": "t:sections.all.animation.option__11.label"
        },
        {
          "value": "snake-left",
          "label": "t:sections.all.animation.option__12.label"
        },
        {
          "value": "snake-right",
          "label": "t:sections.all.animation.option__13.label"
        },
        {
          "value": "3d-up",
          "label": "t:sections.all.animation.option__14.label"
        }
      ],
      "default": "none",
      "visible_if": "{{ section.settings.background_type == 'video' }}"
    },
    {
      "type": "color",
      "id": "background_overlay",
      "label": "t:sections.all.background_overlay.label",
      "alpha": true,
      "visible_if": "{{ section.settings.background_type == 'image' or section.settings.background_type == 'video' }}"
    },
    {
      "type": "number",
      "id": "background_margin",
      "label": "t:sections.all.background_margin.label",
      "default": 0
    },
    {
      "type": "number",
      "id": "padding_top",
      "label": "t:sections.all.padding_top.label",
      "default": 50
    },
    {
      "type": "number",
      "id": "padding_bottom",
      "label": "t:sections.all.padding_bottom.label",
      "default": 50
    }
  ]
}
{% endschema %}
