Issue
- How to embed a custom MVC portlet into Liferay Web Content Article
Environment
- Liferay DXP 7.4
Resolution
- Liferay DXP offers a powerful Taglib with a special tag
<@liferay_portlet["runtime"]>
, which allows the embedding of a specific MVC portlet directly into a Web Content article. - Navigate to Site Administration > Content & Data > Web Content, and create a new structure as per requirement.
- Then navigate to the Template section and select the desired structure from the Properties tab located on the right side of the editor. This structure will be used for the template.
- Add the following Liferay portlet Taglib within the template:
-
<div id="embedded-welcome-portlet-example">
<@liferay_portlet["runtime"]
defaultPreferences=""
instanceId="vwyk"
portletName="TestPortlet"
queryString="" />
</div> - After adding the tag, ensure that the correct
instanceId
andportletId
of the portlet are provided within the code and ensure they match the actual values assigned to the portlet in your Liferauy Instance. - Finally, create new web content with structure and template, publish it into a page, and verify the result to ensure the portlet displays correctly.