{% for module in page.collection({'items':{'@taxonomy.category': 'sidebar'},'order': {'by': 'default', 'dir': 'asc'}}) %}
{% if module.template %}
{% if module.header.surround %}
{% include 'sidebar/' ~ module.template ~ '.html.twig' %}
{% endif %}
{% endif %}
{% endfor %}

<div class="sidebar section" id="sidebar">
{% for module in page.collection({'items':{'@taxonomy.category': 'sidebar'},'order': {'by': 'default', 'dir': 'asc'}}) %}
{% if module.template %}
{% if not module.header.surround %}
{% include 'sidebar/' ~ module.template ~ '.html.twig' %}
{% endif %}
{% endif %}
{% endfor %}

{% if config.plugins.simplesearch.enabled %}
<div class="widget HTML">
  <h2 class="title">SimpleSearch</h2>
  <div class="widget-content simplesearch">
    {% include 'partials/simplesearch_searchbox.html.twig' %}
  </div>
</div>
{% endif %}
{% if config.plugins.random.enabled %}
<div class="widget HTML">
  <h2 class="title">Random Article</h2>
  <div class="widget-content">
    <a class="button" href="{{ base_url_relative }}/random"><i class="fa fa-retweet"></i> I'm Feeling Lucky!</a>
  </div>
</div>
{% endif %}
{% if config.plugins.taxonomylist.enabled %}
<div class="widget HTML">
  <h2 class="title">Popular Tags</h2>
  <div class="widget-content">
    {% include 'partials/taxonomylist.html.twig' with {'base_url':new_base_url, 'taxonomy':'tag'} %}
  </div>
</div>
{% endif %}

{% if config.plugins.archives.enabled %}
<div class="widget HTML">
  <h2 class="title">Archives</h2>
  <div class="widget-content">
    {% include 'partials/archives.html.twig' %}
  </div>
</div>
{% endif %}
{% if config.plugins.feed.enabled %}
<div class="widget HTML syndicate">
  <h2 class="title">Syndicate</h2>
  <div class="widget-content">
    <a class="button" href="{{ feed_url }}.atom"><i class="fa fa-rss-square"></i> Atom 1.0</a>
    <a class="button" href="{{ feed_url }}.rss"><i class="fa fa-rss-square"></i> RSS</a>
  </div>
</div>
{% endif %}
</div>
