From 89745bb37d184a4144c860a0eac8a1aec3684000 Mon Sep 17 00:00:00 2001 From: Nutomic Date: Thu, 19 Sep 2024 15:43:58 +0200 Subject: [PATCH] Add category to RSS feeds (fixes #3446) (#5030) --- crates/routes/src/feeds.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/routes/src/feeds.rs b/crates/routes/src/feeds.rs index 80c1c7281..2db3f9661 100644 --- a/crates/routes/src/feeds.rs +++ b/crates/routes/src/feeds.rs @@ -27,6 +27,7 @@ use lemmy_utils::{ }; use rss::{ extension::{dublincore::DublinCoreExtension, ExtensionBuilder, ExtensionMap}, + Category, Channel, EnclosureBuilder, Guid, @@ -559,6 +560,10 @@ fn create_post_items(posts: Vec, protocol_and_hostname: &str) -> Lemmy BTreeMap::from([("content".to_string(), vec![thumbnail_ext.build()])]), ); } + let category = Category { + name: p.community.title, + domain: Some(p.community.actor_id.to_string()), + }; let i = Item { title: Some(sanitize_html(sanitize_xml(p.post.name).as_str())), @@ -570,6 +575,7 @@ fn create_post_items(posts: Vec, protocol_and_hostname: &str) -> Lemmy link: Some(post_url.clone()), extensions, enclosure: enclosure_opt, + categories: vec![category], ..Default::default() };