Replies: 1 comment 4 replies
-
Interesting! But yeah, if you have a sample page you can share that shows how/where you're embedding these images maybe it will spark some other ideas. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hiya folks!
I'm looking to paginate across all the images I've used. I'm currently primarily using nunjucks, but I would totally be open to a WebC or other solution!
It seems like if I want to collect the images into a collection by just using it in the content guts (with a shortcode or WebC component, or something) rather than by declaring a list of images used in the frontmatter or something, I can't really get that data until after I need to have the collection for pagination.
I tried a few approaches, read some source, read the docs. I landed on what I'm prototyping right now--multiple passes. (I really hesitated a lot before landing on this workaround.) I collect image data in the same shortcode that generates the HTML, and use an eleventy.after hook to compare it with global data I've effectively cached in a .json file. If there's a difference, it prints a message telling me I need to build again. The pagination then happens across the data from the json file.
I can't shake the feeling that I might be complicating things. Any insights or suggestions would be greatly appreciated, but maybe these questions can help shake something loose.
eleventy.after
touch the pagination file and then do an incremental build or something? If I stick with this multipass approach, I guess I'll have to look into calling into eleventy rather than using the existing CLI tooling.Thanks everyone!
Beta Was this translation helpful? Give feedback.
All reactions