You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a pipeline setup that I've migrated over from Wyam to Statiq that has worked fine, until the latest beta versions which I think change some of the IO processing. I've been feeling like it's a little hacky anyway, and thought I'd ask a question of it and see where it goes...
I have a few different document types for different pages which share a common "header-image" metadata field which points to a file path, e.g.
header-image: assets/header-01.png
---
Some content
which can be edited through Netlify. Because the images are uploaded by content editors, they can sometimes end up large/the wrong aspect ratios, so I've been resizing them, and then updating the document metadata with the new file path, with something like this:
returns a new document with the new file path in the output
and then this gets written out in Razor later as an <img>
All of this worked fine, but felt a little icky (e.g. the call to ExecuteModulesAsync and the having an inner module do a file output), but this on the latest betas is now failing if multiple input documents point to the same header images, and try to write out to the same file, there's a conflict at the file system level.
There are a couple of things I've considered, but wonder if there's a step back that would make it more sensible, or if there's something I've missed?
memoize the CopyAndResizeImageFromField so there's only ever one output for the same input document
output a random file name so there's no conflict at the output stage
pull out a separate pipeline that just does header images for all input documents, the sticking point here is how to mutate the documents to have the updated file names from the post processing
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a pipeline setup that I've migrated over from Wyam to Statiq that has worked fine, until the latest beta versions which I think change some of the IO processing. I've been feeling like it's a little hacky anyway, and thought I'd ask a question of it and see where it goes...
I have a few different document types for different pages which share a common "header-image" metadata field which points to a file path, e.g.
which can be edited through Netlify. Because the images are uploaded by content editors, they can sometimes end up large/the wrong aspect ratios, so I've been resizing them, and then updating the document metadata with the new file path, with something like this:
which
and then this gets written out in Razor later as an
<img>
All of this worked fine, but felt a little icky (e.g. the call to
ExecuteModulesAsync
and the having an inner module do a file output), but this on the latest betas is now failing if multiple input documents point to the same header images, and try to write out to the same file, there's a conflict at the file system level.There are a couple of things I've considered, but wonder if there's a step back that would make it more sensible, or if there's something I've missed?
CopyAndResizeImageFromField
so there's only ever one output for the same input documentBeta Was this translation helpful? Give feedback.
All reactions