Skip to content

Commit 2eddf55

Browse files
committed
People: add podcast mentions functionality
1 parent 571d040 commit 2eddf55

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

_layouts/person.html

+8
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@
5757

5858
{{notices | default: newline}}
5959

60+
{%- if page.podcast_mentions.size > 0 -%}
61+
## Optech podcast appearances
62+
63+
{%- for mention in page.podcast_mentions -%}
64+
{{newline}}- [{{mention.title}}]({{mention.url}})
65+
{%- endfor -%}
66+
{% endif %}{{newline}}{{newline}}
67+
6068
{%- if page.optech_mentions and page.optech_mentions != '' -%}
6169
## Optech newsletter mentions
6270

_plugins/bidirectional_links_generator.rb

+20
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,26 @@ def generate(site)
110110
end
111111
end
112112
end
113+
114+
# Podcast appearances
115+
# =====================
116+
podcast_pages = pages_with_link_syntax.select { |doc| doc.url.start_with?("/#{lang}/podcast/") }.reverse
117+
people_pages = site.collections["people"].docs
118+
119+
people_pages.each do |person|
120+
podcast_mentions = []
121+
# Iterate over podcast pages to find mentions of people
122+
podcast_pages.each do |podcast|
123+
podcast_intro = podcast.content.each_line.first.chomp
124+
if podcast_intro.include?("href='#{person.url}'")
125+
podcast_mentions << {"title"=> podcast.title, "url"=> podcast.url}
126+
# the excerpt of pages is calculated by Jekyll before generators run
127+
# therefore we need to override the excerpt to remove [[]]
128+
podcast.excerpt.content = podcast_intro
129+
end
130+
end
131+
person.data["podcast_mentions"] = podcast_mentions
132+
end
113133
end
114134

115135
def liquify(content, date)

0 commit comments

Comments
 (0)