<div class="{{ _sb_class }}">
  <div id="sidebar-blog" class="sidebar{% if _sidebar_style == '2' %} sidebar-style-2{% endif %}">
    
    {% unless section.settings.blog_categories_menu == blank %}
      <div class="sb-widget">
        <div class="sb-menu">

          {% unless section.settings.blog_categories_title == blank %}
            <h5 class="sb-title">{{ section.settings.blog_categories_title }}</h5>
          {% endunless %}

          <ul class="blog-menu">
            {% for l in linklists[section.settings.blog_categories_menu].links %}
              {% assign submenu = l.title | handleize %}

              {% if linklists[submenu].links.size > 0 %}
                {% include 'sb-dropdown-menu' %}
              {% else %}
                <li><a href="{{ l.url }}">{{ l.title }}</a></li>
              {% endif %}
            
            {% endfor %}
          </ul>

        </div>
      </div>
    {% endunless %}

    {% if section.settings.enable_search_blog %}
      <div class="sb-widget">
        <div class="search-blog">

          <form action="/search" method="get">
            <input type="hidden" name="type" value="article" />
            <input type="text" name="q" class="form-control"  placeholder="Search ... " autocomplete="off" />
            <button type="submit"><i class="demo-icon {{ settings.search_font_icon }}"></i></button>
          </form>

        </div>
      </div>
    {% endif %}

    {% unless section.settings.sidebar_post == blank %}
      <div class="sb-widget">
        <div class="sb-blog-posts">

          {% unless section.settings.sidebar_post_title == blank %}
            <h5 class="sb-title">{{ section.settings.sidebar_post_title }}</h5>
          {% endunless %}

          {%- assign _blog = blogs[section.settings.sidebar_post] -%}
          
          {% unless _blog.articles_count == 0 %}
          	<div class="post-list">
            
              {% for article in _blog.articles limit: section.settings.sidebar_post_limit %}
                <div class="post-item">

                  <div class="post-item-inner">
                    {% if article.image %}
                      <div class="post-image">
                        <a href="{{ article.url }}">
                          <img src="{{ article | img_url: '150x' }}" alt="Blog" />
                        </a>
                      </div>
                    {% endif %}

                    <div class="post-content">
                      <div class="info">
                        <h6><a href="{{ article.url }}">{{ article.title }}</a></h6>
                      </div>
                      
                      <div class="meta-data">
                        <span class="date">{{ article.published_at | date: "%B %d, %Y" }}</span>
                      </div>
                    </div>
                  </div>         

                </div>
              {% endfor %}
            
            </div>
          {% endunless %}

        </div>
      </div>
    {% endunless %}

    {% if section.settings.show_ss_widget %}
      <div class="sb-widget">
        <div class="sb-blog-social-widget">

          {% unless section.settings.sidebar_ss_heading == blank %}
            <h5 class="sb-title">{{ section.settings.sidebar_ss_heading }}</h5>
          {% endunless %}

          {% include 'social-sharing' %}

        </div>
      </div>
    {% endif %}

    {% if section.settings.enable_sidebar_tags %}
      <div class="sb-widget">
        <div class="sb-blog-tag">

          {% unless section.settings.sidebar_tags_title == blank %}
            <h5 class="sb-title">{{ section.settings.sidebar_tags_title }}</h5>
          {% endunless %}

          <ul class="list-inline">
            <li><a href="{{ blog.url }}">{{ 'blogs.all' | t }}</a></li>
            {% for tag in blog.all_tags %}
 
              {% if current_tags contains tag %}
                <li class="active">{{ tag | link_to_remove_tag: tag }}</li>
              {% else %}
                <li>{{ tag | link_to_tag: tag }}</li>
              {% endif %}

            {% endfor %}
          </ul>

        </div>
      </div>
    {% endif %}

  </div>
</div>