Skip to content
Discussion options

You must be logged in to vote

Personally I would go for unique ID's. If you use something like uuid you're pretty much guaranteed to have a unique ID each time. That doesn't solve your second point though, they would be different on each build. Unless your JS uses these unique id's to create an id="uniqueID" in your HTML that someone can link to, it probably won't be an issue.

That said, you could do what you want with something like this;

export default (eleventyConfig) => {
   // Set a counter for the instances of the shortcode.
  let instanceCount = 0;

  // Reset the counter before each build otherwise they will continue to increment. 
  eleventyConfig.on("eleventy.before", async ({ directories, runMode, outputMode }

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@Ryuno-Ki
Comment options

@stepanzak
Comment options

@cypressSap
Comment options

@dwkns
Comment options

Answer selected by stepanzak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants