Open all Dynamic Rich Text Links in New Tab


I have a rich text field that is dynamically linked. I’m able to manually set each link to open in an external tab, but I have a lot of links and would like for all links, by default, to open in a new tab so that I don’t have to set each manually.

I’ve tried adding a custom attribute when styling the links inside the rich text field, but it seems the attribute only applies to that individual link. (Referring to our blog posts under resources)

Is there anyway to add this as a default? Thanks so much.

Here is my public share link: LINK
(how to access public share link)

Everything that is not in the Style tab doesn’t apply to the class of the element, but is unique to it.

Use custom code to add that property to all links under rich text elements.

.w-richtext a { target="_blank" }

Put the code in the <head> section of your template pages’ custom code.

Thanks for the reply. Gotcha, makes sense.

Did as you said, unfortunately after publishing it does not seem to have worked. To reiterate: these are text links inside of a Rich Text Block that is dynamically linked - as of now the links only open in external tabs if I change the setting inside of my collection.

Any ideas/do you need any other info from me? Thanks.

Sorry I must be very tired, my answer was totally wrong… Target is an attribute and I wrote it as CSS…

I’m very very ashamed :smiley:

So Javascript is needed to write attributes on the fly to all links. And I don’t write javascript sorry :confused:

Haha no worries, thanks so much for the help