chore: include title tag on rss even if title is missing
01fcce5b
1 file(s) · +3 −3
| 215 | 215 | let mut items = String::new(); |
|
| 216 | 216 | for post in &posts { |
|
| 217 | 217 | let link = format!("{}/posts/{}", site_url, xml_escape(&post.slug)); |
|
| 218 | - | let title_elem = match post.title.as_deref().map(str::trim).filter(|s| !s.is_empty()) { |
|
| 219 | - | Some(t) => format!(" <title>{}</title>\n", xml_escape(t)), |
|
| 218 | + | let title = match post.title.as_deref().map(str::trim).filter(|s| !s.is_empty()) { |
|
| 219 | + | Some(t) => xml_escape(t), |
|
| 220 | 220 | None => String::new(), |
|
| 221 | 221 | }; |
|
| 222 | 222 | let description = match &post.meta_description { |
|
| 231 | 231 | let guid = format!("{}/posts/{}", site_url, xml_escape(&post.slug)); |
|
| 232 | 232 | ||
| 233 | 233 | items.push_str(&format!( |
|
| 234 | - | " <item>\n{title_elem} <link>{link}</link>\n <guid>{guid}</guid>\n <description>{description}</description>\n <pubDate>{pub_date}</pubDate>\n </item>\n" |
|
| 234 | + | " <item>\n <title>{title}</title>\n <link>{link}</link>\n <guid>{guid}</guid>\n <description>{description}</description>\n <pubDate>{pub_date}</pubDate>\n </item>\n" |
|
| 235 | 235 | )); |
|
| 236 | 236 | } |
|
| 237 | 237 | ||