{% set node_classes = [
  'node',
  'node--story',
  'node--full',
] %}
{% set attributes = attributes|default(create_attribute()) %}

{% extends "@ui-node/node--full.html.twig" %}

{% block node_header %}
  {% if
    node_field_ert_story_type or
    node_field_published_date
  %}
    <div class="node__metadata">
      {% if node_field_ert_story_type %}
        <div class="node__story-type">
          {{ node_field_ert_story_type }}
        </div>
      {% endif %}

      {% if node_field_published_date %}
        <div class="node__dates">
          <div class="node__published-date">{{ node_field_published_date }}</div>
          {% if node_field_updated_date %}
            <div class="node__update-date">| Updated: {{ node_field_updated_date }}</div>
          {% endif %}
        </div>
      {% endif %}
    </div>
  {% endif %}

  {{ parent() }}

  {% if node_field_subtitle %}
    <div class="node__subtitle">
      {{ node_field_subtitle }}
    </div>
  {% endif %}

  {% if node_field_ern_related_people %}
    <div class="node__by-line">
      {% set authors = [] %}

      by:

      {% for author in node_field_ern_related_people %}
        {% set authors = authors|merge([
          author|render
        ]) %}
      {% endfor %}

      {{- authors|join(', ', ' and ')|raw -}}
    </div>
  {% endif %}
{% endblock %}

{% block node_content %}
  {% if node_field_erp_sections %}
    <div class="node__sections">
      {{ node_field_erp_sections }}
    </div>
  {% endif %}

  {% if node_topics %}
    <div class="node__topics">
      {{ node_topics }}
    </div>
  {% endif %}

  {% if node_view_stories_related_by_topic %}
    <div class="node__view-stories-related-by-topic">
      {{ node_view_stories_related_by_topic }}
    </div>
  {% endif %}
{% endblock %}
