Article meta info

Information

Folder
src/components/patterns/article-meta-info

Files

Schema
// src/components/patterns/article-meta-info/schema.yaml

$schema: http://json-schema.org/draft-07/schema#
$id: /patterns/article-meta-info
additionalProperties: false
properties:
  author:
    type: string
  format:
    type: string
  date:
    type: string
  date_time:
    type: string
Mocks
// src/components/patterns/article-meta-info/mocks.yaml

author: Kristina Oberhäuser
format: FORMAT
date: 12.03.2021
date_time: '2021-03-12 00:00:01'
Template
// src/components/patterns/article-meta-info/article-meta-info.html.twig

<div class="ArticleMetaInfo u-container u-typo-copy-small-bold u-grid{% if class %} {{ class }}{% endif %}">
  <ul class="ArticleMetaInfo-items">
    {% if authors %}
      <li class="ArticleMetaInfo-item">
        Ein Artikel von
        {% for author in authors %}
          {% if author.url %}
            <a class="ArticleMetaInfo-itemLink u-brandLink" href="{{ author.url }}">{{ author.name }}</a>
          {% else %}
            <span>{{ author.name }}</span>
          {% endif %}
          {% if not loop.last %} & {% endif %}
        {% endfor %}
      </li>
    {% endif %}
    {% if experts %}
      <li class="ArticleMetaInfo-item">
        mitwirkende Expert:innen
        {% for expert in experts %}
          <a class="u-brandLink" href="{{ expert.url }}">{{ expert.name }}</a>
          {% if not loop.last %} & {% endif %}
        {% endfor %}
      </li>
    {% endif %}
    {% if format %}
      <li class="ArticleMetaInfo-item">{{ format }}</li>
    {% endif %}
    {% if date %}
      <li class="ArticleMetaInfo-item">
        <time datetime="{{ date_time|date("Y-m-d") }}">{{ date }}</time>
      </li>
    {% endif %}
  </ul>
</div>

Variants

default
Open