{# Taxonomy and section template to render /news/ #} {% extends 'base.html' %} {% block content %}

{{ resource.title }}

{# Iterate and use en sections by default and use localized versions only if they are present #} {% set enNewsSectionTranslation = resource.translations | filter(attribute='lang', value='en') | first %} {% set enNewsSection = get_section(path=enNewsSectionTranslation.path) %} {% for sectionStr in enNewsSection.subsections | sort | reverse %} {% set section = get_section(path=sectionStr) %} {% for page in section.pages %} {% set translatedPage = page.translations | filter(attribute='lang', value=lang) | first %} {% if translatedPage %} {% set page = get_page(path=translatedPage.path) %} {% endif %}
 {{ page.date | date(format='%B %e, %Y') }} 
{# Display wide images below the text instead of to the right. #} {% set_global noflex = '' %} {% for photo in page.assets %} {% if photo is not matching("\.mp[34]$") %} {% set meta = get_image_metadata(path=photo) %} {# TODO: How to get dimensions of video? #} {% if meta.width > meta.height %} {% set_global noflex = '_noflex' %} {% break %} {% endif %} {% endif %} {% endfor %}
{% if page.content %}
{{ page.content | safe }}
{% endif %} {% for media in page.assets | sort %} {% if media is matching("\.mp3$") %} {% elif media is matching("\.mp4$") %} {% else %} {# It's images #} {% set meta = get_image_metadata(path=media) %} {% endif %} {% endfor %}
{% endfor %} {% endfor %} {% endblock content %}