Dynamic addPassthroughCopy based on collection entry data #1841
Unanswered
nachtfunke
asked this question in
Q&A
Replies: 1 comment 3 replies
-
Do you have a public repo or something? Curious how your assets are organized vs your template locations. plus it makes it a bit easier to clone and hack vs recreating a similar env locally. Q: did you mean to return not sure if this will work, versus using the variable eleventyConfig.addPassthroughCopy({ [srcPath]: distPath }); |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was wondering, if it's somehow possible to set passthrough copies dynamically?
I currently have a collection of
post
. Each post uses a template that overrides itspermalink
. The output file structure is different from the input file structure. The input looks like:posts/{{n}}/
, the output looks likeblog/{{year}}/{{slug}}/
. I am now trying to add assets to each post's folder and I somehow need to tell eleventy to copy that image to its correct output destination.I have managed to access all the data, but if I understood it correctly, there is no way of accessing collections data outside of
addCollection()
? This is the code that gave me access to everything I needed, but it's not working:I know that I can solve this by changing my file structure. Or by just passing through images to a central space. But before I fall back to this, I was wondering if in general:
.eleventy.js
, unless a new filter/sorting is being added as a new collection, and...addPassthroughCopy
?It feels like I have gotten juuuust close enough, but something is missing.
Beta Was this translation helpful? Give feedback.
All reactions