Add related-posts section to the post reader
Add related-posts section to the post reader
#32 in Riparion/riparion-cms — merged 2026-06-01
Brings the previously-unmerged related-posts feature (originally on feat/related-posts, commit 89f996b) onto current main. It had drifted out of the UI because it was never merged — and main has since landed the complexity-cleanup refactor (#31) that split reader.rs into reader/ and the multi-backend (sqlite + postgres) Pool abstraction. This re-applies the feature adapted to both.
What it does
Shows summary cards for the most popular published posts sharing the current post's category or tags, between the reaction bar and comments on the single-post page.
related_posts_db— matches on shared category or any shared tag; ranks by shared-tag count, then view count, then recency. Excludes the post itself and unpublished posts.related_postsserver fn (POST /api/posts/related, limit clamped 1–6).RelatedPostscomponent inreader/post.rs, rendered only for published posts and hidden entirely when there are no matches (no empty heading).
Adapted during the rebase
reader.rswas split intoreader/by #31 — theRelatedPostscomponent and its wiring now live insrc/pages/reader/post.rs, andPostCardViewis re-exported fromwidgets/mod.rs.related_posts_dbrewritten to use thePoolabstraction and$Nplaceholders withsqlx::AssertSqlSafe(the original predated the postgres backend and usedSqlitePool+?).related_postsnow callsattach_card_variantsso related cards get the same responsive WebP/AVIF renditions as every other card-returning feed (the original predated responsive images).
Verification
cargo fmt --all -- --check✓cargo clippyserver,sqlite ✓ / server,postgres ✓ / web(wasm) ✓ — all-D warnings
🤖 Generated with Claude Code
Last updated 2026-06-02
Links to this note
Credits
Merged pull requests, newest first.