Legacy Knowledge Base
Published Sep. 10, 2025

[CKEditor] Paragraph tag is appended to content in blogs by default

Written By

Rita Schaff

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • We are using CKEditor instead of the regular editor. When putting some content into the HTML field while creating blogs <p> and </p> tags are appended by default.
  • We would like to remove these tags or change them to another one.

Environment

  • DXP 7.2

Resolution

  • This is the normal behavior of the editor WYSIWYG CKEditor, which AlloyEditor is based on.
    Both editors can be configured to change their behaviors as desired.
  • Attached a sample portlet that removes the tags.
  • Also, the user can choose the default tag by adding this property in the portal-ext.properties and restarting the portal:

    editor.wysiwyg.default=ckeditor // to use by default CKEditor
    or
    editor.wysiwyg.default=alloyeditor // to use by default AlloyEditor

In order to change this behavior, you need to set the CKEditor configuration setting config.enterMode to the proper value.

  • The default creates a paragraph element each time the "enter" key is pressed (this one is recommended and the correct one to use as per documentation):
    config.enterMode = CKEDITOR.ENTER_P; // inserts <p></p>

  • You can choose to create a "div" element instead of a paragraph:
    config.enterMode = CKEDITOR.ENTER_DIV; // inserts <div></div>

  • To completely remove the tags, if you prefer to not wrap the text in anything, you can choose to insert a line break tag:
    config.enterMode = CKEDITOR.ENTER_BR; // inserts <br />

The application developer indicates that using the ENTER_BR setting is not recommended. 
See the documentation for more information here.

There are three more settings that are somewhat related to this subject:
config.fillEmptyBlocks
config.forceEnterMode
config.ignoreEmptyParagraph

Additional Information

Did this article resolve your issue ?

Legacy Knowledge Base