Move talks into separate include files

This commit is contained in:
Oliver Davies 2015-10-22 00:23:34 +01:00
parent 251fbb57d7
commit b1ec837352
4 changed files with 60 additions and 75 deletions

View file

@ -0,0 +1,23 @@
{% set year = 0 %}
{% for talk in data.talks if date(talk.date) < date('today') %}
{% if loop.first %}
<h2>Previous Talks</h2>
{% endif %}
{% if talk.date|date('Y') != year %}
{% set year = talk.date|date('Y') %}
</ul>
<h3>{{ year }}</h3>
<ul>
{% endif %}
<li>
{{- include('talk-listing-item') -}}
</li>
{% endfor %}
{% if year != 0 %}
</ul>
{% endif %}

View file

@ -1,15 +1,13 @@
<li> <strong>{% spaceless %}
<strong>{% spaceless %}
{% if talk.fuzzy_date %}
{{ talk.date|date('F') }}
{% else %}
{{ talk.date|date('jS F') }}
{% endif %}
{% endspaceless %}</strong> - {{ talk.event.name }}
-
{% if talk.fuzzy_date %} {% if talk.fuzzy_date %}
{{ talk.title }} {{ talk.date|date('F') }}
{% else %} {% else %}
<a href="{{ talk.url }}">{{ talk.title }}</a> {{ talk.date|date('jS F') }}
{% endif %} {% endif %}
</li> {% endspaceless %}</strong> - {{ talk.event.name }}
-
{% if talk.fuzzy_date %}
{{ talk.title }}
{% else %}
<a href="{{ talk.url }}">{{ talk.title }}</a>
{% endif %}

View file

@ -0,0 +1,23 @@
{% set year = 0 %}
{% for talk in data.talks if date(talk.date) >= date('today') %}
{% if loop.first %}
<h2>Upcoming Talks</h2>
{% endif %}
{% if talk.date|date('Y') != year %}
{% set year = talk.date|date('Y') %}
</ul>
<h3>{{ year }}</h3>
<ul>
{% endif %}
<li>
{{- include('talk-listing-item') -}}
</li>
{% endfor %}
{% if year != 0 %}
</ul>
{% endif %}

View file

@ -4,7 +4,8 @@ nav: talks
title: Talks title: Talks
meta: meta:
description: 'Information about previous and upcoming talks that Oliver has presented at conferences and user groups' description: 'Information about previous and upcoming talks that Oliver has presented at conferences and user groups'
use: [talks] use:
- talks
--- ---
<h1>Talks</h1> <h1>Talks</h1>
@ -14,65 +15,5 @@ you would like to me to speak at your group or conference, please <a href="/cont
<p>There is also information about events that Ive attended and spoken at on my <p>There is also information about events that Ive attended and spoken at on my
<a href="{{ site.lanyrd.url }}">Lanyrd</a> and <a href="{{ site.joindin.url }}">Joind.in</a> profiles.</p> <a href="{{ site.lanyrd.url }}">Lanyrd</a> and <a href="{{ site.joindin.url }}">Joind.in</a> profiles.</p>
{% set now = 'today'|date('U') %} {{ include('upcoming-talks') }}
{% set talks = data.talks %} {{ include('previous-talks') }}
{% set found, year, new_year = false, '0', false %}
{% for talk in talks|reverse if talk.date >= now %}
{% if loop.first %}
<h2>Upcoming Talks</h2>
{% endif %}
{% set this_year %}{{ talk.date|date('Y') }}{% endset %}
{% if this_year != year %}
{% if new_year %}
{# Close the list for the previous year. #}
</ul>
{% endif %}
{% set found, year = true, this_year %}
<h3>{{ this_year }}</h3>
<ul>
{% else %}
{% set new_year = true %}
{% endif %}
{% include 'talk-listing-item' %}
{% endfor %}
{% if found %}
</ul>
{% endif %}
{% set found, year, new_year = false, '0', false %}
{% for talk in talks if talk.date < now %}
{% if loop.first %}
<h2>Previous Talks</h2>
{% endif %}
{% set this_year %}{{ talk.date|date('Y') }}{% endset %}
{% if this_year != year %}
{% if new_year %}
{# Close the list for the previous year. #}
</ul>
{% endif %}
{% set year, found = this_year, true %}
<h3>{{ this_year }}</h3>
<ul>
{% else %}
{% set new_year = true %}
{% endif %}
{% include 'talk-listing-item' %}
{% endfor %}
{% if found %}
</ul>
{% endif %}