From da9e6bd3cc5b285976b510cfead0e295c4fb455d Mon Sep 17 00:00:00 2001 From: itsjunetime Date: Sun, 10 Dec 2023 19:30:52 -0700 Subject: [PATCH] Only show the first 20 lines of posts in the main view to make the initial request smaller --- backend/src/home.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/src/home.rs b/backend/src/home.rs index 1b44eeb..91fd1c1 100644 --- a/backend/src/home.rs +++ b/backend/src/home.rs @@ -103,7 +103,13 @@ impl RenderOnce for Posts { } } } - div(class = "post-content") : Raw(post.html); + div(class = "post-content") : Raw( + // only do the first 20 lines since it's gonna hide past that + post.html.split("br") + .take(20) + .collect::>() + .join("br") + ); div(class = "post-footer") { : "Posted at "; strong : shared_data::title_time_string(post.created_at);