From 076802cb5b77f11610f0238c998cf4417c3340a0 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 2 Jan 2025 01:07:54 +0000 Subject: [PATCH] Add "More podcast episodes with..." block If a guest has been on multiple podcast episodes, show a list on an episode page linking to their other episodes. For this to work, each page needs `data.podcast_episodes` to be in scope, so `use: [podcast_episodes]` needs to be added to the episode. Whilst I could do this only for the specific episodes, adding it to all the episodes will make it clearer in the future that I need to have it instead of forgetting to add it and wondering why it doesn't work. --- .../podcast/other-episodes.html.twig | 22 +++++++++++++++++++ source/_layouts/podcast_episode.html.twig | 8 +++++++ source/_podcast_episodes/1-retrofit.md | 1 + .../10-ryan-weaver-symfonycasts.md | 1 + source/_podcast_episodes/11-mark-conroy.md | 1 + .../12-nick-janetakis-docker.md | 1 + .../13-ryan-szrama-centarro.md | 1 + .../14-yuri-gerasymov-diffy.md | 1 + .../15-rob-allen-domain-driven-design.md | 1 + .../16-simon-graham-weight-loss.md | 1 + source/_podcast_episodes/17-jochen-lillich.md | 1 + source/_podcast_episodes/18-andy-hoang.md | 1 + source/_podcast_episodes/19-sam-mortenson.md | 1 + .../2-alternate-realities.md | 1 + source/_podcast_episodes/20-george-gordon.md | 1 + .../21-eirik-morland-violinist-2.md | 1 + source/_podcast_episodes/22-dave-liddament.md | 1 + .../_podcast_episodes/23-jurgen-haas-eca.md | 1 + .../24-chris-ballard-generative-ai.md | 1 + .../25-jess-archer-drush-laravel-prompts.md | 1 + .../3-non-technical-contribution.md | 1 + .../4-ed-crompton-oxfam-case-study.md | 1 + .../5-dieter-blomme-technical-debt.md | 1 + .../_podcast_episodes/6-dan-leech-php-tui.md | 1 + .../7-mike-karthauser-testing-legacy.md | 1 + .../8-eirik-morland-violinist.md | 1 + source/_podcast_episodes/9-tim-lehnen.md | 1 + 27 files changed, 55 insertions(+) create mode 100644 source/_includes/podcast/other-episodes.html.twig diff --git a/source/_includes/podcast/other-episodes.html.twig b/source/_includes/podcast/other-episodes.html.twig new file mode 100644 index 00000000..1a6e2731 --- /dev/null +++ b/source/_includes/podcast/other-episodes.html.twig @@ -0,0 +1,22 @@ +{% set other_episodes = [] %} + +{% for episode in all_episodes %} + {% if episode.guests|first is same as(guest) and episode.topic is not same as(topic) %} + {% set other_episodes = other_episodes|merge([episode]) %} + {% endif %} +{% endfor %} + +{% if other_episodes is not empty %} +
+

Other episodes with {{ guest }}

+ + +
+{% endif %} diff --git a/source/_layouts/podcast_episode.html.twig b/source/_layouts/podcast_episode.html.twig index d9f212e6..dd8c308f 100644 --- a/source/_layouts/podcast_episode.html.twig +++ b/source/_layouts/podcast_episode.html.twig @@ -75,4 +75,12 @@ {% endfor %}