Skip to content

Commit

Permalink
FIx archives page template code to work with Jinja 2.9
Browse files Browse the repository at this point in the history
Closes #10
  • Loading branch information
MinchinWeb committed Jan 11, 2017
1 parent a132800 commit 8eb7608
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 30 deletions.
1 change: 1 addition & 0 deletions docs/changelog.rst
Expand Up @@ -2,6 +2,7 @@ Changelog
=========

- :release:`2.0.3 <2017-01-10>`
- :bug:`10` fix archive page template code to work with Jinja2 v2.9.0
- :bug:`-` fix link color in body area of panel-primary (fixes regression
from version 2.0.2)
- :release:`2.0.2 <2017-01-10>`
Expand Down
63 changes: 33 additions & 30 deletions seafoam/templates/archives.html
Expand Up @@ -19,15 +19,24 @@
{% block content %}
<section id="content">
<h1>Archives for {{ SITENAME }}</h1>

{#
{% for article in dates %}
{{ dates[loop.index0].date }} -
{{ article.date }}
{{loop.index0 == 0 }}
{{(article.date.year != dates[loop.index0 - 1].date.year)}} /
{% endfor %}
#}


<div id="archives">
{# Top Row with links to Archives by Year #}
<div class="row">
<div class="archives-quicklinks text-center col-xs-12">
{%- set last_year = None -%}
{% for article in dates %}
{% if article.date.year != last_year %}
{% if last_year != None %} &bull; {% endif -%}
{%- set last_year = article.date.year -%}
{% if loop.index0 == 0 or (article.date.year != dates[loop.index0 - 1].date.year) %}
{% if loop.index0 != 0 %} &bull; {% endif -%}
<a href="#{{ article.date.year }}">{{ article.date.year }}</a>
{%- endif -%}
{%- endfor %}
Expand All @@ -37,14 +46,10 @@ <h1>Archives for {{ SITENAME }}</h1>
</div>

{# Main Archive Listing #}
{%- set last_year = None -%}
{%- set last_month = None -%}
{%- set last_day = None -%}

{% for article in dates %}
<div class="row">
{% if article.date.year != last_year %}
{% if last_year != None -%}
{% if (loop.index0 == 0) or (article.date.year != dates[loop.index0 - 1].date.year) %}
{% if loop.index0 != 0 -%}
<div class="archives-spacer col-xs-12">&nbsp;</div>
<div class="archives-spacer col-xs-12">&nbsp;</div>
{%- endif %}
Expand All @@ -55,37 +60,35 @@ <h1>Archives for {{ SITENAME }}</h1>
<div class="archives-title col-xs-7 col-sm-6">
&nbsp;
</div>
{%- set last_year = article.date.year -%}
{%- set last_month = None -%}
{%- set last_day = None -%}
{% endif %}
{% if article.date.month != last_month %}
{% if last_month != None -%}
<div class="archives-spacer col-xs-12">&nbsp;</div>
{%- endif %}
<div class="archives-date archives-month col-xs-4 col-md-2 col-md-offset-2">
<a name="{{ article.date.year }}-{{ article.date.month }}"></a>
{{- article.date|strftime('%B') -}}
</div>
<div class="archives-title col-xs-7 col-sm-6">
&nbsp;
</div>
{%- set last_month = article.date.month -%}
{%- set last_day = None -%}
{% if (loop.index0 == 0) or
(article.date.year != dates[loop.index0 - 1].date.year) or
((article.date.year == dates[loop.index0 - 1].date.year) and (article.date.month != dates[loop.index0 - 1].date.month)) %}
{% if ((article.date.year == dates[loop.index0 - 1].date.year) and (article.date.month != dates[loop.index0 - 1].date.month)) -%}
<div class="archives-spacer col-xs-12">&nbsp;</div>
{%- endif %}
<div class="archives-date archives-month col-xs-4 col-md-2 col-md-offset-2">
<a name="{{ article.date.year }}-{{ article.date.month }}"></a>
{{- article.date|strftime('%B') -}}
</div>
<div class="archives-title col-xs-7 col-sm-6">
&nbsp;
</div>
{% endif %}

<div class="archives-date categories-timestamp col-xs-4 col-md-2 col-md-offset-2">
{%- if last_day != article.date.day %}
<time datetime="{{ article.date.isoformat() }}">{{ article.date | strftime('%a %-d') }}</time>
{%- if ((article.date.day == dates[loop.index0 - 1].date.day) and
(article.date.month == dates[loop.index0 - 1].date.month) and
(article.date.year == dates[loop.index0 - 1].date.year)) %}
&mdash;
{% else -%}
&nbsp;
<time datetime="{{ article.date.isoformat() }}">{{ article.date | strftime('%a %-d') }}</time>
{%- endif -%}
</div>
<div class="archives-title col-xs-7 col-md-6">
<a href="{{ SITEURL }}/{{ article.url }}">{{ article.title }}</a>
{% if article.subtitle %}<br />{{ article.subtitle }}{% endif %}
</div>
{%- set last_day = article.date.day %}
</div>
{% endfor %}
</div>
Expand Down

0 comments on commit 8eb7608

Please sign in to comment.