diff --git a/source/_includes/previous-talks.html.twig b/source/_includes/previous-talks.html.twig new file mode 100644 index 00000000..b10d207d --- /dev/null +++ b/source/_includes/previous-talks.html.twig @@ -0,0 +1,23 @@ +{% set year = 0 %} + +{% for talk in data.talks if date(talk.date) < date('today') %} + {% if loop.first %} +

Previous Talks

+ {% endif %} + + {% if talk.date|date('Y') != year %} + {% set year = talk.date|date('Y') %} + + +

{{ year }}

+ +{% endif %} diff --git a/source/_includes/talk-listing-item.html.twig b/source/_includes/talk-listing-item.html.twig index d92c0339..b82fe5af 100644 --- a/source/_includes/talk-listing-item.html.twig +++ b/source/_includes/talk-listing-item.html.twig @@ -1,15 +1,13 @@ -
  • - {% spaceless %} - {% if talk.fuzzy_date %} - {{ talk.date|date('F') }} - {% else %} - {{ talk.date|date('jS F') }} - {% endif %} - {% endspaceless %} - {{ talk.event.name }} - - +{% spaceless %} {% if talk.fuzzy_date %} - {{ talk.title }} + {{ talk.date|date('F') }} {% else %} - {{ talk.title }} + {{ talk.date|date('jS F') }} {% endif %} -
  • +{% endspaceless %} - {{ talk.event.name }} +- +{% if talk.fuzzy_date %} + {{ talk.title }} +{% else %} + {{ talk.title }} +{% endif %} diff --git a/source/_includes/upcoming-talks.html.twig b/source/_includes/upcoming-talks.html.twig new file mode 100644 index 00000000..fd57dd2d --- /dev/null +++ b/source/_includes/upcoming-talks.html.twig @@ -0,0 +1,23 @@ +{% set year = 0 %} + +{% for talk in data.talks if date(talk.date) >= date('today') %} + {% if loop.first %} +

    Upcoming Talks

    + {% endif %} + + {% if talk.date|date('Y') != year %} + {% set year = talk.date|date('Y') %} + + +

    {{ year }}

    + +{% endif %} diff --git a/source/talks.html.twig b/source/talks.html.twig index dc024d5e..a0f21e6b 100644 --- a/source/talks.html.twig +++ b/source/talks.html.twig @@ -4,7 +4,8 @@ nav: talks title: Talks meta: description: 'Information about previous and upcoming talks that Oliver has presented at conferences and user groups' -use: [talks] +use: + - talks ---

    Talks

    @@ -14,65 +15,5 @@ you would like to me to speak at your group or conference, please Lanyrd and Joind.in profiles.

    -{% set now = 'today'|date('U') %} -{% set talks = data.talks %} - -{% set found, year, new_year = false, '0', false %} - -{% for talk in talks|reverse if talk.date >= now %} - {% if loop.first %} -

    Upcoming Talks

    - {% endif %} - - {% set this_year %}{{ talk.date|date('Y') }}{% endset %} - - {% if this_year != year %} - {% if new_year %} - {# Close the list for the previous year. #} - - {% endif %} - - {% set found, year = true, this_year %} - -

    {{ this_year }}

    - -{% endif %} - -{% set found, year, new_year = false, '0', false %} - -{% for talk in talks if talk.date < now %} - {% if loop.first %} -

    Previous Talks

    - {% endif %} - - {% set this_year %}{{ talk.date|date('Y') }}{% endset %} - - {% if this_year != year %} - {% if new_year %} - {# Close the list for the previous year. #} - - {% endif %} - - {% set year, found = this_year, true %} - -

    {{ this_year }}

    - -{% endif %} +{{ include('upcoming-talks') }} +{{ include('previous-talks') }}