Custom FTL Macro Library in Liferay
Freemarker Macro Library Implementation Overview Liferay has an embedded freemarker library, which contains FTL macroses and functions to help with templates implementation. In this article we’ll review how out-of-the-box FTL Macro library works, and how to implement a custom one. Liferay FTL Library Review Default liferay FTL library is exposed with a FTL_liferay.ftl file in the portal-template-freemarker module. There is a FreeMarkerEngineConfiguration configuration, which references this library file and defines an alias (“liferay”) for it: @Meta.AD ( deflt = "FTL_liferay.ftl as liferay" , name = "macro-library" , required = false ) public String [] macroLibrary (); This configuration can be modified in System Settings -> Template Engines -> Freemarker Engine: FTL_liferay.ftl file contains a lot of macroses and functions, which can be used in freemarker templates - for themes, widget templates or even fragments....