Only add a link if there is an episode URL

This commit is contained in:
Oliver Davies 2019-03-26 09:08:49 +00:00
parent 78d41cc041
commit e1af70b32b

View file

@ -25,6 +25,12 @@ episodes:
date: 2019-03-08 date: 2019-03-08
url: ~ url: ~
--- ---
{% macro episodeTitle(podcast, episode) -%}
{{ podcast.name }}: {{ episode.title }}
{%- endmacro %}
{% import _self as helpers %}
<!-- <header class="mb-6"> <!-- <header class="mb-6">
<p class="text-lg"> <p class="text-lg">
Im an occasional guest on podcasts such as Talking Drupal. Im an occasional guest on podcasts such as Talking Drupal.
@ -37,9 +43,13 @@ episodes:
<article> <article>
<h2 class="text-lg"> <h2 class="text-lg">
<a href="{{ episode.url }}" class="text-inherit" tabindex="-1"> {% if episode.url %}
{{ podcast.name }}: {{ episode.title }} <a href="{{ episode.url }}" class="text-inherit" tabindex="-1">
</a> {{ helpers.episodeTitle(podcast, episode) }}
</a>
{% else %}
{{ helpers.episodeTitle(podcast, episode) }}
{% endif %}
</h2> </h2>
<time class="text-sm text-gray-800 block mt-px mb-2" datetime="{{ episode.date|date('Y-m-d') }}"> <time class="text-sm text-gray-800 block mt-px mb-2" datetime="{{ episode.date|date('Y-m-d') }}">
@ -48,11 +58,13 @@ episodes:
<p>{{ episode.description }}</p> <p>{{ episode.description }}</p>
<a href="{{ episode.url }}" class="inline-block mt-2 text-sm text-gray-600 hover:text-gray-800 focus:text-gray-800"> {% if episode.url %}
{{ episode.video ? 'Watch' : 'Listen to' }} this <a href="{{ episode.url }}" class="inline-block mt-2 text-sm text-gray-600 hover:text-gray-800 focus:text-gray-800">
<span class="visuallyhidden">{{ podcast.name }}</span> {{ episode.video ? 'Watch' : 'Listen to' }} this
episode &rarr; <span class="visuallyhidden">{{ podcast.name }}</span>
</a> episode &rarr;
</a>
{% endif %}
</article> </article>
{% endfor %} {% endfor %}
</div> </div>