Search code examples
liferayliferay-7

Liferay - Difference between Widget, Fragment and Portlet


I am new to Liferay and it seems that I can do the same thing with Fragments, Widgets and Portlets. Can someone please explain the difference to me?
Thank you in advance.


Solution

  • Widget is the new name for Portlet - they're absolutely the same. But, as stated by Victor in the comment to this answer, the reason for renaming them was to be open to include other types of widgets - so, at time of creation, they're identical, but widgets are meant to be a broader category than portlets.

    Content Pages are somewhat new kinds of pages (for few releases now) that can contain more than just widgets: The other building blocks typically consist of HTML code, CSS and Javascript - optionally some configuration. These building blocks are called Fragments.

    You can build full-blown frontend apps with fragments (utilizing headless and other REST APIs), but they're originally meant for Content-oriented features. You decide how much of the possibilities you want to use, and where proper app deployment makes your system more manageable.

    To add some confusion to this: There's an extension type in the OSGi world, that you can use within Liferay as well: Fragment bundles. Those are specific bundles that override some of the resources in other bundles. Most notably it's used for JSPs, so you can replace them this way without modifying an original bundle.