Content Injection

Content Injection allows you to update site content using Duda's API instead of opening the editor. It's a great option for pushing new site content and creating templates without using a site's Content Library to store the data.

Content Injection provides you a way to identify a particular element and target it to change a few common properties, which we call Content Types. There are three types of content available to you when using Content Injection: innerHTML, DOM attributes, and CSS rules.

innerHTML

If you're familiar with HTML & Javascript, this one is pretty self-explanatory. innerHTML enables you to update an element's innerHTML property to include different text, child elements, or other content. For example, a common use case would be to update the headline and subheadline after creating a new site from a template.

DOM Attributes

The DOM Attribute content type allows you to update a specific attribute of an element. For example, you can change an anchor tag's href attribute or assign a custom data attribute that you reference in custom JavaScript.

CSS Rules

The CSS Rule content type allows you to update any style property of an element. For example, you could change the transition property of an element to alter its animation so that returning site visitors receive a slightly different experience during their next visit.


What’s Next
Did this page help you?