<nav id=“sidebar”>

<!-- Sidebar Header -->
<div class="sidebar-header text-center">
  <a href="/">
    Sundry Codes
  </a>
</div>

<div class="sidebar-search visible-xs">
  <div class="col-xs-12">
    <form action="" class="search-form">
      <div class="form-group has-feedback">
        <label for="search" class="sr-only">Search</label>
        <input type="text" class="search-query form-control" placeholder="Search" name="pattern" value="pattern" >
        <span class="glyphicon glyphicon-search form-control-feedback"></span>
      </div>
    </form>
  </div>
</div>

<!-- Sidebar Links -->
<div class="container">

  <ul class="list-unstyled components">
    <!-- Here would be better off instorucing my Info. -->

    <li class="active">
      <a href="#categorySubmenu" data-toggle="collapse" aria-expanded="true">
        Categories
      </a>
      <ul class="collapse in list-unstyled" id="categorySubmenu">
        {% assign lists_categories = site.posts | map: "categories" %}
        {% assign categories = lists_categories | uniq | sort %}
        {% if categories != empty %}
          {% for category in categories %}
            <li class="{% if page.categories contains category %}current{% endif %}">
              <a href="/category/#{{ category }}"
                 title="Show all entries in {{ category }}">{{ category }}
                 <span class="label pull-right">
                   {% assign post_count = 0 %}
                   {% for i in lists_categories %}
                     {% if i contains category %}
                       {% assign post_count = post_count | plus: 1 %}
                     {% endif %}
                   {% endfor %}

                   {% case post_count %}
                     {% when 0 %}No post
                     {% when 1 %}{{ post_count }} post
                     {% else %}{{ post_count }} posts
                   {% endcase %}
                 </span>
              </a>
            </li>
          {% endfor %}
        {% else %}
        <li class="">
          <a href="#">No categories yet.</a>
        </li>
        {% endif %}
      </ul>
    </li>

    <li class="active">
      <a href="#recententriesSubmenu" data-toggle="collapse" aria-expanded="true">
        Recent posts
      </a>
      <ul class="collapse in list-unstyled" id="recententriesSubmenu">
        {% if site.posts != empty %}
          {% for post in site.posts %}
            {% if forloop.index > 10 %}
              {% break %}
            {% endif %}
            <li class="">
              <a href="{{ post.url | absolute_url }}" title="{{ post.title }}" rel="bookmark">{{ post.title }}</a>
            </li>
          {% endfor %}
        {% else %}
          <li class="">
            <a href="#">No posts yet.</a>
          </li>
        {% endif %}
      </ul>
    </li>

    <li class="active">
      <a href="#tagcloudSubmenu" data-toggle="collapse" aria-expanded="true">
        Tags
      </a>
      {% assign lists_tags = site.posts | map: "tags" %}
      {% assign tags = lists_tags | uniq | sort %}
      {% assign avg = tags.size | times: 1.0 | divided_by: lists_tags.size %}
      <ul id="tagcloudSubmenu" class="callapse in list-unstyled {% if tags == empty %}no-{% endif %}tag-cloud">
        {% if tags != empty %}
          {% for tag in tags %}
            {% assign post_count = 0 %}
            {% for i in lists_tags %}
              {% if i contains tag %}
                {% assign post_count = post_count | plus: 1 %}
              {% endif %}
            {% endfor %}

            <li>
              <a href="/tag/#{{ tag }}"
                 title="{% case post_count %}
                          {% when 0 %}No post
                          {% when 1 %}{{ post_count }} post tagged by {{ tag }}
                          {% else %}{{ post_count }} posts tagged by {{ tag }}
                        {% endcase %}"
                 class="tag-{{ post_count | divided_by: avg | times: 2.5 | floor }}{% if post.tags contains tag %} current{% endif %}">{{ tag }}</a>
            </li>
          {% endfor %}
        {% else %}
          <li>
            No tags yet.
          </li>
        {% endif %}
      </ul>
    </li>

    <li class="active">
      <a href="#recentcomments" data-toggle="collapse" aria-expanded="true">
        Recent comments
      </a>
      <div id="recentcomments" class="dsq-widget collapse in"><script type="text/javascript" src="https://sundry-rockheung.disqus.com/recent_comments_widget.js?num_items=5&hide_avatars=1&avatar_size=32&excerpt_length=200"></script></div>
    </li>

  </ul>
</div>

</nav>