ナレッジベース
公開されました 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

knowledge-article-header-disclaimer-how-to

knowledge-article-header-disclaimer

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

ナレッジベース