{% load history_extras %}
{% if month %}
  <p class="pagination">
    <a href="{% history_url year=month %}">{{ month.year }}</a>
  </p>
{% endif %}
<p class="pagination n3">
  {% if month %}
    {% if previous_month %}
      <a href="{% history_url month=previous_month %}">{{ previous_month|date:"F Y"|capfirst }}</a>
    {% endif %}
    <a class="cur" href="{% history_url month=month %}">{{ month|date:"F Y"|capfirst }}</a>
    {% if next_month %}
      <a href="{% history_url month=next_month %}">{{ next_month|date:"F Y"|capfirst }}</a>
    {% endif %}
  {% elif year %}
    {% if previous_year %}
      <a href="{% history_url year=previous_year %}">{{ previous_year|date:"Y" }}</a>
    {% endif %}
    <a class="cur" href="{% history_url year=year %}">{{ year|date:"Y" }}</a>
    {% if next_year %}
      <a href="{% history_url year=next_year %}">{{ next_year|date:"Y" }}</a>
    {% endif %}
  {% endif %}
</p>
