October 22, 2024
Chicago 12, Melborne City, USA
javascript

Preventing/Intercepting HTML elements being generated by CMS widgets (Duda CMS)


I need to get rid of hidden HTML elements in widgets that are generated by the CMS my agency is using (Duda CMS). They get loaded in even if they have no values assigned (like empty h3s for images in the gallery widget, which is terrible for SEO obviously)…

I tried to remove them with JavaScript (element.remove();), but that didn’t work out.
Also this method would be useless from an SEO-perspective anyways bc if I got this correctly JavaScript can only handle elements that are already loaded right?

I checked the code in the backend so maybe I can intercept the source but there are just a bunch of divs with data-binding-metadata filled with random numbers. So editing it out there is no option as well…

My question is: Is there a way to inspect the mechanisms of the elements being generated in the code in the inspector so I can understand the source better and maybe intercept it?

Or is there a method to prevent it from being loaded at all?

Here’s an example of unused "hidden" gallery rows I want to get rid of:

<div class="photogallery-row" data-index="0">...</div>
<div class="photogallery-row photogallery-hidden-row" data-index="1">...</div>
<div class="photogallery-row photogallery-hidden-row" data-index="2">...</div>
<div class="photogallery-row photogallery-hidden-row" data-index="3">...</div>
<div class="photogallery-row photogallery-hidden-row" data-index="4">...</div>
<div class="photogallery-row photogallery-hidden-row" data-index="5">...</div>



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video