Add latest comments to latest lane on main landing page

This commit is contained in:
Roan Horning 2025-07-16 10:42:05 -04:00
parent 991f088ded
commit 71c1c46cfb
Signed by: rho_n
GPG Key ID: 234AEF20B72D5769

View File

@ -85,26 +85,49 @@
<section id="latest_shows">
<header>Latest Shows</header>
<!--% host_cnt = 0 %-->
<ul>
<!--% FOREACH latest_episodes IN DBI.query(query_latest_episodes)
%-->
<ul>
<li><a href="<!--% absolute_path(baseurl) %-->eps/hpr<!--% zero_pad_left(latest_episodes.id) %-->/index.html">hpr<!--% latest_episodes.id %--> :: <!--% latest_episodes.title %--></a></li>
</ul>
<li><a href="<!--% absolute_path(baseurl) %-->eps/hpr<!--% zero_pad_left(latest_episodes.id) %-->/index.html">hpr<!--% latest_episodes.id %--> :: <!--% latest_episodes.title %--></a></li>
<!--% host_cnt = host_cnt + 1 %-->
<!--% END %-->
<article id="previous_five_weeks">
<header>
<hr>
<h1>Previous five weeks</h1>
</header>
<!--% FOREACH last_5_weeks_episodes IN DBI.query(query_last_5_weeks_episodes)
%-->
<!--% show_summary(last_5_weeks_episodes) %-->
<p class="listen-in"><!--% display_listen_in(last_5_weeks_episodes.id) %--></p>
<!--% END %-->
</article>
<h1>Older Shows</h1>
<p>
Get a <a href="<!--% absolute_path(baseurl) %-->eps/index.html">full list</a> of all our shows.
</p>
</ul>
</section>
<section id="latest_comments">
<header>Latest Comments</header>
<ul>
<!--% FOREACH item IN DBI.query('
WITH episode_comment_rank AS (
SELECT
comments.eps_id
, comments.id as comment_id
, comments.comment_author_name
, comments.comment_timestamp
, comments.comment_title
, RANK() OVER (PARTITION BY eps_id ORDER BY id ) AS comment_number
FROM comments
)
SELECT
episode_comment_rank.*
, hosts.host
, eps.title AS episode_title
, eps.date AS episode_date
FROM episode_comment_rank
INNER JOIN eps
ON episode_comment_rank.eps_id = eps.id
INNER JOIN hosts
ON eps.hostid = hosts.hostid
ORDER BY episode_comment_rank.comment_timestamp DESC
LIMIT 10;
')
%-->
<li>hpr<!--% item.eps_id %--> (<!--% item.episode_date %-->) "<!--% item.episode_title %-->" by <!--% item.host %-->
<ul>
<li><a href="<!--% absolute_path(baseurl) %-->eps/hpr<!--% zero_pad_left(item.eps_id) %-->/index.html#comment_<!--% item.comment_id%-->">Comment <!--% item.comment_number %-->: <!--% item.comment_author_name %--> on <!--% item.comment_timestamp %-->: "<!--% item.comment_title %-->"</a>
</li>
</ul>
</li>
<!--% END %-->
</ul>
</section>