Knowledge Base
Published Jun. 30, 2025

Freemarker templates escape HTML content in Text fields after migrating from Liferay DXP 7.3 to 2025.Q1

Written By

Daniel Martinez Cisneros

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.

Issue

  • After migrating from Liferay DXP 7.3 to 2025.Q1, HTML content within web content "Text" fields is no longer interpreted by Freemarker templates using ${field.getData()}. It is displayed as escaped HTML.

Environment

  • Liferay DXP 7.3
  • Liferay DXP 2025.Q1+

Resolution

Use the following Freemarker code to unescape the HTML content from the text field:

${htmlUtil.unescape(fieldName.getData())}

Additional Information

  • While using "Rich Text" fields is generally recommended for HTML content, this workaround helps prevent data loss during migrations and avoids manual re-entry of content when dealing with existing "Text" fields containing HTML.
Did this article resolve your issue ?

Knowledge Base