eleventy icon indicating copy to clipboard operation
eleventy copied to clipboard

Is it possible to know all the pages before execution of a custom transform?

Open terpimost opened this issue 1 year ago • 2 comments
trafficstars

Operating system

Linux

Eleventy

2.0.1

Describe the bug

I would like to process all the pages in a deterministic way, but right now pages to custom transform are passed in non deterministic way (order of pages is different on different computers). Is it possible to somehow have an index of pages before my transform is executed, so I at least can have a sorted list of all pages inside my transform?

Reproduction steps

No response

Expected behavior

No response

Reproduction URL

No response

Screenshots

No response

terpimost avatar Apr 01 '24 22:04 terpimost

Just so I’m clear, what do you mean by process? You want to influence the order in which pages are processed by Eleventy?

If not and the processing order doesn’t matter here—does this event work?

eleventyConfig.on("eleventy.contentMap", ({ inputPathToUrl }) => {});

Read more about Eleventy events: https://www.11ty.dev/docs/events/ (though this one is missing from the docs)

There are a couple other ways to get this information, but we can start here I think

zachleat avatar Apr 09 '24 15:04 zachleat

Oh, thank you. That helps. Worth of putting it into the docs!

terpimost avatar Apr 10 '24 02:04 terpimost

Shipping the eleventy.contentMap event to the docs: https://www.11ty.dev/docs/events/

zachleat avatar May 28 '24 18:05 zachleat