{% extends "td_cms/layouts/sidebar_block.html" %}

{% load i18n %}
{% load fb_versions %}
{% load td_cms_tags %}

{% block sidebar_block_class %}top-articles{% endblock sidebar_block_class %}

{% block sidebar_block %}
<h3>
    {% trans "Now on top" %}
</h3>

<ul class="articles">
    {% get_highlighted_pages as featured_pages %}

    {% for page in featured_pages %}
        <li class="article">
            <h5 class="title">
                <a href="{{ page.get_absolute_url }}" title="{{ page.title }}">
                    {{ page.title }}
                </a>
            </h5>
            {% if page.image %}
            <a href="{{ page.get_absolute_url }}" title="{{ page.title }}" class="article-image">
                <img src="{% version page.image 'thumbnail' %}" alt="{{ page.title }}" class="page-thumbnail" />
            </a>
            {% endif %}
            <div class="synopsis">
                {% if page.synopsis %}
                {{ page.synopsis|truncatewords_html:20|safe }}
                {% else %}
                {{ page.content|truncatewords_html:20|safe }}
                {% endif %}
            </div>
            <a href="{{ page.get_absolute_url }}" class="read-more">
                {% trans "Read more" %}
            </a>
        </li> <!-- /.article -->
    {% endfor %}
</ul>

<div class="more-articles">
    {% with page.categories.all.0 as category %}
    <a href="{{ category.get_absolute_url }}" title="{% trans "Read more articles of" %} {{ category.name }}">
        {% trans "More articles" %}
    </a>
    {% endwith %}
</div>
{% endblock sidebar_block %}
