Multiple copies of embeds appear in a page or article
Symptoms
Multiple copies of external HTML embeds are showing up on a page or article
Multiple embeds from the same source site are included on the same page or article
The number of copies of each embed displayed is equal to the total number of embeds from that same site.
Cause
The embed script to build the embedded content element is being called multiple times. Often embed codes provided by external sites will include a placeholder element such as a <div>
or <a>
tag, as well as a <script>
element. Sometimes, the provided script element is designed to look for all elements with a particular class name and transform these elements into the expected embedded content, such as an <iframe>
. In these cases, the <script>
element should only be run once, to avoid the creation of duplicate content.
Solution
The <script>
element must be removed from all but one of the embeds.
Locate each of the HTML blocks or placeholder elements containing embeds from the same site.
For all but one of these, modify the embed to remove the embed
<script>
, leaving only the placeholder element. For example:
<div class="my-embed" data-url="https://www.embed-site.com/"></div><script>src="http://www.embed-site.com/embed.js"</script>
Becomes:
<div class="my-embed" data-url="https://www.embed-site.com/"></div>