{% load staticfiles mptt_tags news_tags %}
<div class="col-lg-4">
    <div class="blog_right_sidebar">
        {#        <aside class="single_sidebar_widget search_widget">#}
        {#            <div class="input-group">#}
        {#                <input type="text" class="form-control" placeholder="Search Posts">#}
        {#                <span class="input-group-btn">#}
        {#                     <button class="btn btn-default" type="button"><i class="lnr lnr-magnifier"></i></button>#}
        {#                </span>#}
        {#            </div>#}
        {#            <div class="br"></div>#}
        {#        </aside>#}
        {#        <aside class="single_sidebar_widget author_widget">#}
        {#            <img class="author_img rounded-circle" src="img/blog/author.png" alt="">#}
        {#            <h4>Charlie Barber</h4>#}
        {#            <p>Senior blog writer</p>#}
        {#            <div class="social_icon">#}
        {#                <a href="#"><i class="fa fa-facebook"></i></a>#}
        {#                <a href="#"><i class="fa fa-twitter"></i></a>#}
        {#                <a href="#"><i class="fa fa-github"></i></a>#}
        {#                <a href="#"><i class="fa fa-behance"></i></a>#}
        {#            </div>#}
        {#            <p>Boot camps have its supporters andit sdetractors. Some people do not understand why you#}
        {#                should have to spend money on boot camp when you can get. Boot camps have itssuppor ters#}
        {#                andits detractors.</p>#}
        {#            <div class="br"></div>#}
        {#        </aside>#}
        <aside class="single_sidebar_widget popular_post_widget">
            <h3 class="widget_title">Последние статьи</h3>
            {% for_post_list count=3 as post_list %}
            {% for post in post_list %}
                <div class="media post_item">
                    {% if post.image %}
                        <img src="{{ post.image.image.url }}" alt="{{ post.title }}">
                    {% else %}
                        <img src="{% static 'img/blog/popular-post/post1.jpg' %}" alt="oms cms news">
                    {% endif %}
                    <div class="media-body">
                        <a href="{{ post.get_absolute_url }}"><h3>{{ post.title }}</h3></a>
                        <p>{{ post.published_date|date:"d M, Y" }}</p>
                    </div>
                </div>
            {% endfor %}
            <div class="br"></div>
        </aside>
        {#        <aside class="single_sidebar_widget ads_widget">#}
        {#            <a href="#"><img class="img-fluid" src="{% static 'img/blog/add.jpg' %}" alt=""></a>#}
        {#            <div class="br"></div>#}
        {#        </aside>#}
        <aside class="single_sidebar_widget post_category_widget">
            <h4 class="widget_title">Категории</h4>
            <ul class="list cat-list">
                {% for_category_list as categories %}
                {% recursetree categories %}
                    <li>
                        <a href="{{ node.get_absolute_url }}" class="d-flex justify-content-between">
                            <p>{{ node.name }}</p>
                            <p>{{ node.post_set.all.count }}</p>
                        </a>
                        {% if not node.is_leaf_node %}
                            <ul class="children">
                                {{ children }}
                            </ul>
                        {% endif %}
                    </li>
                {% endrecursetree %}
            </ul>
            <div class="br"></div>
        </aside>
        {#        <aside class="single-sidebar-widget newsletter_widget">#}
        {#            <h4 class="widget_title">Newsletter</h4>#}
        {#            <p>#}
        {#                Here, I focus on a range of items and features that we use in life without#}
        {#                giving them a second thought.#}
        {#            </p>#}
        {#            <div class="form-group d-flex flex-row">#}
        {#                <div class="input-group">#}
        {#                    <div class="input-group-prepend">#}
        {#                        <div class="input-group-text"><i class="fa fa-envelope" aria-hidden="true"></i>#}
        {#                        </div>#}
        {#                    </div>#}
        {#                    <input type="text" class="form-control" id="inlineFormInputGroup"#}
        {#                           placeholder="Enter email" onfocus="this.placeholder = ''"#}
        {#                           onblur="this.placeholder = 'Enter email'">#}
        {#                </div>#}
        {#                <a href="#" class="bbtns">Subcribe</a>#}
        {#            </div>#}
        {#            <p class="text-bottom">You can unsubscribe at any time</p>#}
        {#            <div class="br"></div>#}
        {#        </aside>#}
        <aside class="single-sidebar-widget tag_cloud_widget">
            <h4 class="widget_title">Теги</h4>
            <ul class="list">
                {% for_tags_list as tags %}
                {% for tag in tags %}
                    <li><a href="{{ tag.get_absolute_url }}">{{ tag.name }}</a></li>
                {% endfor %}
            </ul>
        </aside>
    </div>
</div>