From 06ce6a88d8ec25ad4ac64be7e58ce75d785750f6 Mon Sep 17 00:00:00 2001 From: Infides Date: Sun, 19 Mar 2023 14:20:40 +0100 Subject: [PATCH] Colocated images with date from folder --- components/content/src/page.rs | 4 ++++ components/content/src/utils.rs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/components/content/src/page.rs b/components/content/src/page.rs index 94672b2bd..97c913688 100644 --- a/components/content/src/page.rs +++ b/components/content/src/page.rs @@ -672,6 +672,10 @@ And here's another. [^3] assert_eq!(page.meta.date, Some("2013-06-02".to_string())); assert_eq!(page.assets.len(), 3); assert_eq!(page.permalink, "http://a-website.com/posts/with-assets/"); + // Expected: The path for assets should not contain the date + // assert_eq!(page.assets[0], path.join("content/posts/with-assets/fail.png")); + // Implemented: The date is included which should not be the case + assert_eq!(page.assets[0], path.join("content/posts/2013-06-02_with-assets/fail.png")); } #[test] diff --git a/components/content/src/utils.rs b/components/content/src/utils.rs index 58fd3ec84..a26ce5066 100644 --- a/components/content/src/utils.rs +++ b/components/content/src/utils.rs @@ -35,6 +35,8 @@ pub fn find_related_assets(path: &Path, config: &Config, recursive: bool) -> Vec for entry in builder.into_iter().filter_map(std::result::Result::ok) { let entry_path = entry.path(); + println!("Entry path: {}", entry_path.display()); + if entry_path.is_file() && !is_temp_file(entry_path) { match entry_path.extension() { Some(e) => match e.to_str() {