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">
{% if episode.url %}
<a href="{{ episode.url }}" class="text-inherit" tabindex="-1"> <a href="{{ episode.url }}" class="text-inherit" tabindex="-1">
{{ podcast.name }}: {{ episode.title }} {{ helpers.episodeTitle(podcast, episode) }}
</a> </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>
{% if episode.url %}
<a href="{{ episode.url }}" class="inline-block mt-2 text-sm text-gray-600 hover:text-gray-800 focus:text-gray-800"> <a href="{{ episode.url }}" class="inline-block mt-2 text-sm text-gray-600 hover:text-gray-800 focus:text-gray-800">
{{ episode.video ? 'Watch' : 'Listen to' }} this {{ episode.video ? 'Watch' : 'Listen to' }} this
<span class="visuallyhidden">{{ podcast.name }}</span> <span class="visuallyhidden">{{ podcast.name }}</span>
episode &rarr; episode &rarr;
</a> </a>
{% endif %}
</article> </article>
{% endfor %} {% endfor %}
</div> </div>