Files @ 8f4c8a69d6f8
Branch filter:

Location: website/www/conservancy/templates/blog/entry_list.html

bkuhn
Rework blog's custom_index for new pagination.

The pagination support changed, and as was previously done a few commits
ago for news, I'm trying a similar solution for blogs.

In this case, I'm trying to use the existing custom_index() method we
have and adapt it to properly support pagination in the way we want.

I'm not completely sure this will work, but I think it's at least close.
{% extends "base_blog.html" %}
{% block subtitle %}Conservancy Blog - {% endblock %}

{% block content %}

<h2><a href="/feeds/blog/" class="feedlink"><img src="/img/feed-icon-14x14.png" alt="[RSS]"/></a> Conservancy Blog{% if author %} &mdash; {{ author.formal_name }}{% endif %}</h2>

{% if authors or tags %}
<p>Displaying posts
{% if authors %}by {% for author in authors %}{% if not forloop.last %}{% if not forloop.first %}, {% endif %}{% endif %}<a href="{{ author.biography_url }}">{{ author.formal_name }}</a>{% ifequal forloop.revcounter 2 %} and {% endifequal %}{% endfor %}{% endif %}
{% if tags %}tagged {% for tag in tags %}{% if not forloop.last %}{% if not forloop.first %}, {% endif %}{% endif %}<a href="{{ tag.get_absolute_url }}">{{ tag.label }}</a>{% ifequal forloop.revcounter 2 %} or {% endifequal %}{% endfor %}{% endif %}
</p>
{% endif %}

{% for entry in blog_entries %}
    <div class="shaded">
    <p class="date">{{ entry.pub_date|date:"F j, Y" }} by {{ entry.author.formal_name }}</p>
    <h3><a href="{{ entry.get_absolute_url }}">{{ entry.headline|safe }}</a></h3>
        {{ entry.body|safe }}
    <p class="date small">Posted by <strong>{{ entry.author.formal_name}}</strong> on {{ entry.pub_date|date:"F j, Y" }}</p>
    {% if entry.tags.all %}<p class="blog-tags small">Tags: {% for tag in entry.tags.all %}<a href="{{ tag.get_absolute_url }}">{{ tag.label }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</p>{% endif %}
    </div>
{% endfor %}

<p>
{% if blog_entries.has_next %}<a class="next_page_button" href="?page={{ blog_entries.next_page_number }}{% if query_string %}&amp;{{ query_string|escape }}{% endif %}">Next page (older) &raquo;</a>{% endif %}
{% if blog_entries.has_previous %}<a href="?page={{ blog_entires.previous_page_number }}{% if query_string %}&amp;{{ query_string|escape }}{% endif %}">&laquo; Previous page (newer)</a>{% endif %}
</p>
<p>{% for pagenum in blog_entries.paginator.page_range %}{% ifequal pagenum blog_entries.number %}[{{ pagenum }}]{% else %}<a href="?page={{ pagenum }}">{{ pagenum }}</a>{% endifequal %} {% endfor %}
</p>
<div class="clear"></div>

{% if date_list %}
<h3>Blog Index by Year</h3>
<ul>
{% for year in date_list reversed %}<li><a href="{{ year|date:"Y" }}/">{{ year|date:"Y" }}</a></li>{% endfor %}
</ul>
{% endif %}

{% endblock %}