Commit bfeab8ab authored by Huste, Tobias (FWCC) - 111645's avatar Huste, Tobias (FWCC) - 111645 Committed by Erxleben, Fredo
Browse files

Display elements only if content is defined in frontpage templates

parent 89279aba
Pipeline #17343 passed with stages
in 10 minutes and 28 seconds
{% assign event = include.event %} {% assign event = include.event %}
{% assign location = site.data.hifis_organizations[event.location.campus] %} {% assign location = site.data.hifis_organizations[event.location.campus] %}
{% if event %}
<div class="frontpage-card"> <div class="frontpage-card">
<div class="card-body"> <div class="card-body">
{% if event.start.date %}
<span class="badge badge-danger"> <span class="badge badge-danger">
<i class="fas fa-calendar-day" aria-hidden="true"></i> {{ event.start.date | date_to_string }} <i class="fas fa-calendar-day" aria-hidden="true"></i> {{ event.start.date | date_to_string }}
</span> </span>
{% endif %}
{% if event.type %}
<span class="badge badge-secondary"> <span class="badge badge-secondary">
<i class="fas fa-flag" aria-hidden="true"></i> {{ event.type | capitalize }} <i class="fas fa-flag" aria-hidden="true"></i> {{ event.type | capitalize }}
</span> </span>
{% endif %}
{% if location.city %}
<span class="badge badge-primary"> <span class="badge badge-primary">
<i class="fas fa-location-arrow" aria-hidden="true"></i> {{ location.city }} <i class="fas fa-location-arrow" aria-hidden="true"></i> {{ location.city }}
</span> </span>
{% endif %}
{% if event.title %}
<h3 class="card-title"> <h3 class="card-title">
<a href="{{ event.url | relative_url }}">{{ event.title }}</a> <a href="{{ event.url | relative_url }}">{{ event.title }}</a>
</h3> </h3>
<p class="card-text">{{ event.excerpt | strip_html | slice: 0, 150 }}</p> {% else %}
<!--
WARNING: event has no title defined
-->
{% endif %}
{% if event.excerpt %}
<p class="card-text">{{ event.excerpt | strip_html | slice: 0, 150 }}</p>
{% endif %}
<a href="{{ event.url | relative_url }}" class="btn btn-primary"> <a href="{{ event.url | relative_url }}" class="btn btn-primary">
<i class="fas fa-info-circle" aria-hidden="true"></i>&nbsp; More <i class="fas fa-info-circle" aria-hidden="true"></i>&nbsp; More
</a> </a>
</div> </div>
</div> </div>
{% else %}
<!--
WARNING: frontpage/event-card.html was included,
but no event object was defined
-->
{% endif %}
...@@ -2,9 +2,20 @@ ...@@ -2,9 +2,20 @@
{% assign url = include.url %} {% assign url = include.url %}
{% assign caption = include.caption %} {% assign caption = include.caption %}
<div class="frontpage-image-card"> <div class="frontpage-image-card">
{% if image_path %}
<img src="{{ image_path | relative_url }}" class="card-img" alt="{{ caption }}"> <img src="{{ image_path | relative_url }}" class="card-img" alt="{{ caption }}">
{% else %}
<!--
WARNING: frontpage/image-card.html was included but now image was
defined
-->
{% endif %}
<div class="card-img-overlay"> <div class="card-img-overlay">
{% if caption %}
<h3 class="card-title">{{ caption }}</h3> <h3 class="card-title">{{ caption }}</h3>
{% endif %}
{% if url %}
<a href="{{ url | relative_url }}" class="btn btn-outline-light">Learn more</a> <a href="{{ url | relative_url }}" class="btn btn-outline-light">Learn more</a>
{% endif %}
</div> </div>
</div> </div>
{% assign post = include.post %} {% assign post = include.post %}
<div class="frontpage-card"> <div class="frontpage-card">
<div class="card-body"> <div class="card-body">
{% if post.title %}
<a href="{{ post.url | relative_url }}"> <a href="{{ post.url | relative_url }}">
<h3 class="card-title">{{ post.title }}</h3> <h3 class="card-title">{{ post.title }}</h3>
</a> </a>
{% else %}
<!--
WARNING: frontpage/post-card.html was include, but no post title
is defined.
-->
{% endif %}
{% if post.date %}
<div> <div>
<i class="fas fa-calendar-day" aria-hidden="true"></i> {{ post.date | date_to_string }} <i class="fas fa-calendar-day" aria-hidden="true"></i> {{ post.date | date_to_string }}
</div> </div>
{% endif %}
<div> <div>
{% for category in post.categories %} {% for category in post.categories %}
<span class="badge badge-secondary" aria-hidden="true">{{ category | upcase }}</span> <span class="badge badge-secondary" aria-hidden="true">{{ category | upcase }}</span>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment