lumeland / lume

🔥 Static site generator for Deno 🦕
https://lume.land
MIT License
1.79k stars 77 forks source link

Processed image files and filename parsing for dates #284

Closed kari closed 1 year ago

kari commented 1 year ago

I noticed that when using imagick plugin, because it "processes" the image files, these files are apparently treated as pages? Anyway they seem to be subject to Lume's "page date" rules. I had images named like 14455_full.jpg that were outputted as full.jpg. This was a bit unexpected behavior.

My current workaround is to have _data.ts file in my images folder

export function url(page: Page) {
    return page.src.path + page.src.ext;
}

Obviously another workaround is to rename input image files so that they don't match with Lume's date parsing algorithm...

Is there are better way to override Lume's page date parsing? Is this date parsing intended behavior for all kinds of processed files (especially non-text ones)?

oscarotero commented 1 year ago

Yes, they are loaded as pages, but not regular pages, but asset pages (See the difference here: https://lume.land/docs/core/concepts/#page-files).

But I agree that the date extracting from the file name makes no sense in the asset pages, I'll fix this in the next version. Meanwhile, your workaround is fine. Thanks!

oscarotero commented 1 year ago

After some tests, I think that the best solution is remove the interpretation of files starting with a number + _ as a date. It doesn't make sense and it's a too generical pattern that can conflict with many files. Due it's a kind of breaking change I re-schedule this change to 1.13.0.

oscarotero commented 1 year ago

Fixed. It will be available in the next version 1.13.0.