1
0
mirror of https://gitlab.com/Anson-Projects/zine.git synced 2025-06-15 13:16:39 +00:00

keep favicons from being featured image

This commit is contained in:
Anson Biggs 2024-05-20 22:22:52 -06:00
parent 174e622e3d
commit 1df3485ea6

View File

@ -231,11 +231,13 @@ pub fn find_image(post: &mut Post) {
pub fn validate(post: &mut Post) {
if post.title.is_empty() {
post.score = 0;
println!("{} has no title", post.link.as_str());
return;
}
if !post.lang.is_empty() && post.lang != "en" {
post.score = 0;
println!("{} is not english", post.link.as_str());
return;
}
@ -246,7 +248,14 @@ pub fn validate(post: &mut Post) {
if !is_valid_url(post.link.as_str()) {
post.score = 0;
println!("{} is not valid", post.link.as_str());
return;
};
if let Some(image_url) = &post.image_url {
if image_url.ends_with("favicon.ico") {
post.image_url = None;
}
}
}
pub fn retain_first_main_url(posts: &mut Vec<Post>) {