1
0
Fork 0

don't filter away posts when getting tags

This commit is contained in:
Adrian Hedqvist 2023-03-30 00:06:01 +02:00
parent ba465f4bde
commit 50b84a0025

View file

@ -14,7 +14,7 @@ pub struct Tag {
pub fn get_tags<'a>(posts: impl IntoIterator<Item=&'a Post>) -> HashMap<String,Tag> { pub fn get_tags<'a>(posts: impl IntoIterator<Item=&'a Post>) -> HashMap<String,Tag> {
let mut tags: HashMap<String,Tag> = HashMap::new(); let mut tags: HashMap<String,Tag> = HashMap::new();
for post in posts.into_iter().filter(|p| p.is_published()) { for post in posts.into_iter() {
for key in &post.tags { for key in &post.tags {
if let Some(tag) = tags.get_mut(key) { if let Some(tag) = tags.get_mut(key) {
tag.posts.push(post.slug.clone()); tag.posts.push(post.slug.clone());