Skip to content

Commit

Permalink
Fix styles leaking into the rest of the page due to not properly clos…
Browse files Browse the repository at this point in the history
…ing post html code tags
  • Loading branch information
itsjunetime committed Jan 29, 2024
1 parent cf71ebd commit 6a6bf05
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions backend/src/home.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,12 @@ impl RenderOnce for Posts {
}
}
div(class = "post-content") : Raw(
// only do the first 20 lines since it's gonna hide past that
post.html.lines()
.take(20)
// only do the first 5 paragraphs since it's gonna hide past that
post.html.split("</p>")
.take(5)
.collect::<Vec<&str>>()
.join("\n")
.join("</p>")
+ "</p>"
);
div(class = "post-footer") {
: "Posted at ";
Expand Down

0 comments on commit 6a6bf05

Please sign in to comment.