Display the latest pod episodes on the front page

This commit is contained in:
davegson 2019-11-11 16:37:21 +01:00
parent 2c450e98d0
commit ca5df05a5b
3 changed files with 27 additions and 29 deletions

View file

@ -1,34 +1,16 @@
<content>
<div class="cast">
<div class="c-l">
<a href="">
<img src="{{ site.img_url }}podcast.png" alt="">
<div>
<span>How to evaluate and trust a business?</span>
<p>#004</p>
</div>
</a>
<a href="">
<img src="{{ site.img_url }}podcast.png" alt="">
<div>
<span>How to evaluate and trust a business?</span>
<p>#004</p>
</div>
</a>
<a href="">
<img src="{{ site.img_url }}podcast.png" alt="">
<div>
<span>How to evaluate and trust a business?</span>
<p>#004</p>
</div>
</a>
<a href="">
<img src="{{ site.img_url }}podcast.png" alt="">
<div>
<span>How to evaluate and trust a business?</span>
<p>#004</p>
</div>
</a>
{% assign sorted_podcasts = site.podcasts | reverse %}
{% for episode in sorted_podcasts limit: 4 %}
<a href="{{ episode.url }}">
<img src="{{ site.img_url }}podcast.png" alt="">
<div>
<span>{{ episode.title | grab_title_only }}</span>
<p>{{ episode.title | grab_episode_number }}</p>
</div>
</a>
{% endfor %}
</div>
<div class="c-r">
<h1>Stay up to date</h1>

View file

@ -0,0 +1,15 @@
module Jekyll
module PodcastHelper
# Format of a title:
# #001 - Some sweet title
def grab_episode_number(full_title)
full_title[0..4]
end
def grab_title_only(full_title)
full_title[7..-1]
end
end
end
Liquid::Template.register_filter(Jekyll::PodcastHelper)

View file

@ -5,7 +5,8 @@ layout: podcast
<div class="ui divided items">
{% for episode in site.podcasts reversed %}
{% assign sorted_podcasts = site.podcasts | reverse %}
{% for episode in sorted_podcasts %}
<div class="item">
<div class="middle aligned content">
<a href="{{ episode.url }}">{{ episode.title }}</a>