Unwanted duplicate "inject element" in Rich Text — fs-inject

Description

Hello! I’m using Finsweet’s v2 fs-inject to insert an element into a blog rich text element.
I don’t know why, but it seems like the instance gets duplicated when it’s injected using {{cta-name}} which is really annoying. Could you help or investigate if there’s a bug somewhere?

URLs

Read-only link
Staging link

Video/Screenshots

Expected Behavior

Inject ONE instance of the relevant instance into the rich text element

Actual Behavior

Inject TWO instance of this element instead of ONE

Additional Context

  • Browser: Does it in all browsers (Chrome, Brave, Arc, Safari, Firefox)
  • Device: All devices (Desktop, iPhone 13, IPad Air]

Hey @sophie.jpm!

Good news — your inject setup is actually correct :flexed_biceps: The source element, target element, fs-inject-instance, and {{free-trial-signup}} shortcode are all configured properly.

The duplication is happening because your page has both v1 and v2 Attributes scripts loaded at the same time, which unfortunately isn’t supported. When both versions run together, they can each try to process the same elements — which is exactly why the CTA is appearing twice.

Looking at your page, we can see these v1 scripts loaded alongside the v2 script:

  • attributes-richtext@1 (this one specifically processes Rich Text elements and is likely the main culprit)
  • attributes-a11y@1
  • attributes-inputactive@1
  • attributes-cmsnest@1
  • attributes-cmsstatic@1
  • attributes-cmsfilter@1
  • attributes-cmscombine@1
  • attributes-accordion@1
  • attributes-cmsload@1
  • attributes-cmssort@1
  • attributes-cmsselect@1
  • attributes-selectcustom@1
  • attributes-numbercount@1

To fix the duplication:

  1. Remove all of those attributes-*@1 script tags from your page or project settings
  2. Keep only the v2 script:
<script async type="module" src="https://cdn.jsdelivr.net/npm/@finsweet/attributes@2/attributes.js" fs-inject></script>
  1. Republish and test

The v2 script covers all the functionality those v1 scripts were handling — filtering, sorting, loading, etc. — so you shouldn’t lose any features in the process.

If you want help confirming the v2 equivalents are set up correctly after removing the v1 scripts, just let us know which features you’re using and we can walk through it with you.