I want to modify the strong tag which renders in the rich text editor of sitecore.

When I select Core DB and go to the following path I can see the Bold Item as below :-

enter image description here

However I am not sure how and from where the sitecore existing code is rendering that tag when the B is clicked in RTE. Is it possible on configuration level only or do I need to override any method customizing the pipeline as well ?

  • Which version of Sitecore are you using? My instance inserts <strong> tags without any customization. – Marcel Dec 17 '19 at 13:18

According to the HTML 5 specification, the <b> tag should be used as a LAST resort when no other tag is more appropriate. The HTML 5 specification states that headings should be denoted with the <h1> to <h6> tags, emphasized text should be denoted with the <em> tag, important text should be denoted with the <strong> tag, and marked/highlighted text should use the <mark> tag.

However back to your question - Sitecore is using Telerik RTE. I tried to search js or config files where tags are applied to click event but couldn't find anything. Therefore I think there is no easy way how to update tag definition which is linked to particular button.

| improve this answer | |
  • 1
    Thank you for your analysis on this. – Divyansh Gupta Dec 18 '19 at 12:06

<strong> tags should be the default behaviour. At least in Sitecore 9 it appears to be. As mentioned in the other answer, that is preferable to the <b> tag.

If not, according to this article you may need to override a class that inherits from Sitecore.Shell.Controls.RichTextEditor.EditorConfiguration.

public class RichTextEditorCustomConfiguration: Sitecore.Shell.Controls.RichTextEditor.EditorConfiguration
    public RichTextEditorCustomConfiguration(Item profile)
        : base(profile)

    protected override void SetupFilters()
        //Disable the automatic conversion of <i> and <b> tags to <em> and <strong> for icon-* classes

        // If using Sitecore 8.1
        // this.Editor.DisableFilter(EditorFilters.ConvertTags);      


Then add this setting:

<setting name="HtmlEditor.DefaultConfigurationType" value="MyProject.RichTextEditorCustomConfiguration, MyProject"></setting>

This question also points out something interesting. There is a discrepancy between the tag that gets applied when bolding in line vs. in the rich text popup window. Inline, it applies <b>. In the popup, it applies <strong>. For those wanting consistent tag applications, the inline buttons should be disabled, or you should DisableWebEdit on the field and force the user to use the popup editor via an edit frame.

| improve this answer | |
  • Hi Marcel, I tried the provided custom code however I was still getting the <strong> tag rendered for Bold button in RTE. We are using Sitecore 9.2 . Please find the screenshot below :- – Divyansh Gupta Dec 18 '19 at 12:48
  • Another observation is that this only works whenever I am giving Bold from inline editing of RTE. If I am selecting Bold from within the RTE pop-up window, it is still giving me the Strong tag, also at the time of page load the strong tag is getting rendered. – Divyansh Gupta Dec 19 '19 at 6:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.