Duplicate page contributions

Enonic version: 6.11
OS: Windows 10

I have made a part that adds a google maps script as a page contribution to the bodyEnd. As I understand it from the documentation, any duplicate string contributions to the same injection point should be ignored:

  • " If the same string is contributed from different parts, or from the same part that exists multiple times in the page, the value will only be inserted once."

Note: The google maps API script reference is injected as its own separate string, isolated from the map script itself.

It’s not a problem isolated to this particular case though, as I have been experiencing the same problem when I have added jquery through page contributions as well.

Is this something that others are experiencing, and is there any work around for it?

Is the output exactly the same string?

Yeah, they are identical:

<script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyAnHgpg7Sfcn8CPpUCe51Itz5AfYEsjNrs"></script>
<script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyAnHgpg7Sfcn8CPpUCe51Itz5AfYEsjNrs"></script>

How do you add the page contributions? One is added from a part. Is the part added 2 times, or is the other added from a different part or the page?

In this case, the part is added 2 times. But in the jquery case I mentioned, the page contributions were added from different parts. The results were duplicate contributions in both cases.

I cannot reproduce the problem.
Can you send me the parts showing the problem? Maybe a simplified version.

If it’s not available in a public place maybe you can send it via our Slack channel.

This has been sorted. Realized that I contributed multiple variables with strings and that I needed to contribute them in an array

1 Like

Good that it was not a bug.
Thanks for the update :+1: