<div class="article_sidebar_content">
  
  <form class="search" method="get" action="/search">
    <input class="searchBox field" placeholder="Search Blog Topics" type="text" name="q" autocomplete="off"> 
    <input type="hidden" name="type" value="article">
    <button class="searchSubmit submit" type="submit"><i class="fa fa-search" aria-hidden="true"></i></button>
  </form>
  
  {% if section.settings.show_recenet_blog != blank %}
  <div class="article_box blog-module blog-popular-posts box-no-advanced">
    {%- if section.settings.sb_blog_recent_heading != blank -%}
    <div class="box-heading">
      <h4>{{section.settings.sb_blog_recent_heading}}</h4>
    </div>
    {%- endif -%}
    <div class="box-content box-popular-posts">
      <ul class="blog-list-default">
        {%- for article in blog.articles limit:section.settings.sb_blog_recent_limit -%}
        <li>
          <div class="media">
            <a href="{{article.url}}">
              {%- if article.image -%}
              <div class="thumb-holder">
                <img alt="{{article.title | escape}}" src="{{article.image.src | img_url: '100x130', crop: 'top'}}" />
              </div>
              {%- endif -%}
              <div class="media-body">
                <div class="date-published">{{article.published_at | date: "%b %d, %Y"}}</div>
                <h5>{{article.title}}</h5>
              </div>
            </a>
          </div>
        </li>
        {%- endfor -%}
      </ul>
    </div>
  </div>
  {% endif %}
  
  {% if section.settings.show_popular_tag != blank %}
  <div class="article_box blog-module blog-popular-tags box-no-advanced">
    {%- if section.settings.sb_blog_tag_heading != blank -%}
    <div class="box-heading">
      <h4>{{section.settings.sb_blog_tag_heading}}</h4>
    </div>
    {%- endif -%}
    <div class="box-content box-popular-tags">
      <ul class="blog-list-default">
        {%- for tag in blog.all_tags -%}
        <li>
          <a href="{{ blog.url }}/tagged/{{ tag | handle }}">{{ tag }}</a>{% unless forloop.last %}, {% endunless %}
        </li>
        {%- endfor -%}
      </ul>
    </div>
  </div>
  {% endif %}
  
</div>

{% schema %}
  {
    "name": "Barra lateral do Artigo",
    "settings": [
      {
        "type": "header",
        "content": "Post recentes do blog"
      },
	  {
		"type": "checkbox",
		"id": "show_recenet_blog",
		"label": "Mostrar post recentes do blog",
		"default": true
	  },
      {
        "type": "text",
        "id": "sb_blog_recent_heading",
        "label": "Título",
        "default": "Posts recentes"
      },
	  {
        "type": "range",
        "id": "sb_blog_recent_limit",
        "label": "Limite de posts recentes do blog",
        "min": 1,
        "max": 5,
        "step": 1,
        "default": 3
      },
	  {
        "type": "header",
        "content": "Tag"
      },
	  {
		"type": "checkbox",
		"id": "show_popular_tag",
		"label": "Mostrar tags populares",
		"default": true
	  },
	  {
        "type": "text",
        "id": "sb_blog_tag_heading",
        "label": "Título",
        "default": "Tags populares"
      }
	]
  }
{% endschema %}

{% stylesheet %}
{% endstylesheet %}

{% javascript %}
{% endjavascript %}
