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.
Editor 2.0
Content Injection will not work with server-side rendering elements like the following:
- SSR Widgets: Media Slider
- Navigation Links
- Extension Widgets: Calendar
- Flex Containers: Flex Sections
Content Injection is compatible with elements rendered with static HTML like the following:
- Button Widget
- Text Widget
- Image Widget
Updated 4 months ago