Files
bbc-young-reporter/index.md
Matthew Grove 607ec3990c Account for when no articles exist
When no articles exist, the navbar doesn't show the 'Articles' title, and the home page displays an appropriate message
2019-01-28 14:06:27 +00:00

39 lines
1.5 KiB
Markdown

---
title: BBC Young Reporter
description: News articles written by Reading School students in year 8
layout: article-list
---
{% if site.categories.articles %}
{% for article in site.categories.articles %}
<div class="mdc-card">
<div class="mdc-card__media mdc-card__media--16-9 {{ article.url | relative_url | replace: '/', '-' | replace: '.', '-' }}"></div>
<div class="mdc-card-content">
<h2 class="mdc-typography--headline6">{{ article.title }}</h2>
<h3 class="mdc-typography--subtitle2">
<time class="timeago" datetime="{{ article.date | date: '%Y-%m-%d' }}T{{ article.date | date: '%H:%M:%S' }}">{{ article.date | date: '%A %e %B %Y' }}</time>
| by {{ article.authors }}
</h3>
</div>
<div class="mdc-card__actions">
<div class="mdc-card__action-buttons">
<button class="mdc-button mdc-card__action mdc-card__action--button" data-mdc-auto-init="MDCRipple" onclick="window.location='{{ article.url | relative_url }}';">Read</button>
</div>
</div>
</div>
<style>
.{{ article.url | relative_url | replace: '/', '-' | replace: '.', '-' }} {
background-image: url("/images/{{ article.url | relative_url | remove: '.html' | replace: '/', '-' | remove: '-articles-' }}--cover.jpg");
}
</style>
{% endfor %}
{% else %}
<center>We haven't got any articles for you yet! Come back during this year's BBC Young Reporter day to see what Reading School's year 8 students have produced!</center>
<style>
center {
margin: 25vh auto 25vh auto;
}
</style>
{% endif %}