Description in RSS feed

This commit is contained in:
2024-11-24 13:35:23 +01:00
parent 0509565c2b
commit 96ead1a38f
3 changed files with 46 additions and 40 deletions

View File

@ -4,6 +4,7 @@ use chrono::Utc;
use rss::{ChannelBuilder, GuidBuilder, Item, ItemBuilder};
use crate::blog_posts::blog_post_model::{BlogPostMetadata, BLOG_POST_PATH};
use crate::filters::{parse_markdown, truncate_md};
use crate::post_utils::post_listing::get_post_list;
pub async fn render_rss_feed() -> Result<impl IntoResponse, StatusCode> {
@ -26,7 +27,13 @@ pub async fn render_rss_feed() -> Result<impl IntoResponse, StatusCode> {
.title(Some(post.metadata.title))
.link(Some(format!("https://michalvanko.dev/blog/{}", post.slug)))
// TODO Description should be just a preview
.description(None)
.description({
let truncated =
truncate_md(&post.body, 2).unwrap_or("Can't parse post body".to_string());
let parsed_md = parse_markdown(&truncated)
.unwrap_or("Can't process truncated post body".to_string());
Some(parsed_md)
})
.guid(Some(
GuidBuilder::default()
.value(format!("https://michalvanko.dev/blog/{}", post.slug))

View File

@ -56,6 +56,5 @@ async fn main() {
// - fotos
// THINK deploy to alula? rather then katelyn? can be change whenever
//
// TODO view page transitions
// TODO cookbook
// TODO remove m-logo-svg from justfile and mention it in some article!!! WRITE SOME NEW ARTICLES
// TODO remove m-logo-svg from justfile and mention it in some article!!!