{% extends "base.html" %}

{# Pass data through to the base template #}
{% block variable_wormhole %}
{{ super() }}
{% set page_path = section.path %}
{% set title = section.title %}
{% set description = section.description %}
{% if section.extra.uses %}
{% set feature_flags = section.extra.uses %}
{% endif %}
{% if section.extra.redir_to %}
{% set redirect_target = section.extra.redir_to %}
{% endif %}
{% endblock variable_wormhole %}

{# Page content #}
{% block page_start %}
{% include "components/heading-card.html" %}
{% endblock page_start %}
{% block content %}
{{ section.content | safe }}

{# Handle various embed modes #}
{% if section.extra.section_embed_mode %}

{# Blog post injection #}
{% if section.extra.section_embed_mode == "blog_posts" %}
{# <ul style="margin:0"> #}
  <div>
    {# Posts shall be broken down by year #}
    {% set title_year = "3000" %}
    {% for page in section.pages %}
    {% if not page.extra.hidden %}
    {% set page_year = page.date | date(format="%Y")%}
    {% if page_year != title_year %}
    {% set_global title_year = page_year %}

</ul>
<h2>{{title_year}}</h2>
<ul>
  {% endif %}

  <li class="blog-post-li">

    {# Informational icon #}
    {% if page.extra.icon %}
    <i class="{{page.extra.icon}}"></i>
    {% else %}
    <i class="las la-book"></i>
    {% endif %}

    {# Datestamp #}
    <span style="color:{% if page.draft %}red{% else %}gray{% endif %};" class="monospace">{{page.date}}:</span>

    {# Title #}
    <a href="{{page.path}}">{{page.title}}</a>

  </li>
  {% endif %}
  {% endfor %}
</ul>
</div>
{% endif %}

{# Photo collection injection #}
{% if section.extra.section_embed_mode == "photos" %}
{% for collection in section.pages %}
{% include "components/photo-collection-card.html" %}
{% endfor %}
{% endif %}

{# Site timeline injection #}
{% if section.extra.section_embed_mode == "timeline" %}
{% include "components/site-timeline.html" %}
{% endif %}

{% endif %}
{% endblock content %}