Generate Friendly URL through programatically Craeted URLGenerate Friendly URL through programatically Craeted URLhttps://liferay.dev/en/c/message_boards/find_thread?p_l_id=119785333&threadId=1187024332024-03-28T19:11:55Z2024-03-28T19:11:55ZRE: Generate Friendly URL through programatically Craeted URLpradip choudharihttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1187080202020-03-10T14:04:25Z2020-03-10T14:04:25ZHi <strong>Dominik sir , <br /></strong>Thanks for valuable suggestion , I tried above approach but after above approach I am seeing mvcRenderCommandName also came in friendly URL <br /><br /><br /><a href="http://localiticourses.buildyourcareerpath.com:7080/welcome/-/UserProfile/ERZ4txCK76tp/PackageDetails?p_p_state=maximized&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_mvcRenderCommandName=%2Fuserprofileassociates%2Ffatch-perticuler-subcription-package&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_subscriptionPackageId=4&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_isPackageSubscribe=false">/-/UserProfile/ERZ4txCK76tp/PackageDetails?p_p_state=maximized&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_mvcRenderCommandName=%2Fuserprofileassociates%</a>fetch<a href="http://localiticourses.buildyourcareerpath.com:7080/welcome/-/UserProfile/ERZ4txCK76tp/PackageDetails?p_p_state=maximized&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_mvcRenderCommandName=%2Fuserprofileassociates%2Ffatch-perticuler-subcription-package&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_subscriptionPackageId=4&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_isPackageSubscribe=false">-</a>package-detail<a href="http://localiticourses.buildyourcareerpath.com:7080/welcome/-/UserProfile/ERZ4txCK76tp/PackageDetails?p_p_state=maximized&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_mvcRenderCommandName=%2Fuserprofileassociates%2Ffatch-perticuler-subcription-package&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_subscriptionPackageId=4&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_isPackageSubscribe=false">&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_subscriptionPackageId=4&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_isPackageSubscribe=false<br /></a><br /><br />Do u have any other approach to make more less the URL to hidding parameters ?<br /><br />Thanks & Regards, <br />Pradippradip choudhari2020-03-10T14:04:25ZRE: Generate Friendly URL through programatically Craeted URLDominik Markshttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1187076772020-03-10T13:54:05Z2020-03-10T13:54:05Z<html><head></head><body>I think you cannot "hide" those parameters, because the information needs to be somewhere.<br><br>If you want to shorten the URL you could think of adding those parameters as part of the URL or define them as implicit parameters (e.g p_p_state=maximized) . For example like this:<br><br><pre><code>&nbsp; &nbsp; <route>
&nbsp; &nbsp; &nbsp; &nbsp;<pattern>/{instanceId}/selectedPackageDetail/{subscriptionPackageId}/{isPackageSubscribe}</pattern>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<ignored-parameter name="p_p_mode" />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<ignored-parameter name="p_auth" />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<ignored-parameter name="p_p_id" />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<implicit-parameter name="p_p_lifecycle">0</implicit-parameter>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<implicit-parameter name="mvcRenderCommandName">/userprofileassociates/fetch-package-detail</implicit-parameter>
&nbsp; &nbsp; &nbsp; &nbsp; <implicit-parameter name="p_p_state">maximized</implicit-parameter>
&nbsp;&nbsp; &nbsp;</route></code></pre></body></html>Dominik Marks2020-03-10T13:54:05ZRE: Generate Friendly URL through programatically Craeted URLpradip choudharihttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1187069882020-03-10T13:37:17Z2020-03-10T13:37:17ZHi everyone , <br />I reached next step now , But here I am getting some issues <br /><br /><a href="http://localiticourses.buildyourcareerpath.com:7080/welcome/-/UserProfile/ERZ4txCK76tp/selectedPackageDetail?p_p_state=maximized&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_subscriptionPackageId=4&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_isPackageSubscribe=false">http://locacourse:7080/welcome/-/<strong>UserProfile/ERZ4txCK76tp/selectedPackageDetail?p_p_state=maximized&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_subscriptionPackageId=4&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_isPackageSubscribe=false</strong></a><br /><br />How can I hide Parameters <strong><a href="http://localiticourses.buildyourcareerpath.com:7080/welcome/-/UserProfile/ERZ4txCK76tp/selectedPackageDetail?p_p_state=maximized&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_subscriptionPackageId=4&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_isPackageSubscribe=false">subscriptionPackageId</a> , </strong><strong><a href="http://localiticourses.buildyourcareerpath.com:7080/welcome/-/UserProfile/ERZ4txCK76tp/selectedPackageDetail?p_p_state=maximized&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_subscriptionPackageId=4&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_isPackageSubscribe=false">isPackageSubscribe</a> and </strong><strong></strong> <strong><a href="http://localiticourses.buildyourcareerpath.com:7080/welcome/-/UserProfile/ERZ4txCK76tp/selectedPackageDetail?p_p_state=maximized&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_subscriptionPackageId=4&_UserProfileAssociatesPortlet_INSTANCE_ERZ4txCK76tp_isPackageSubscribe=false">p_p_state</a> </strong>in URL ? <br />we cannot go with <ignored-parameter> because it removes from request object , I want to hide this parameters from URL only , because we are using this parameter values in Controller . <br />below I am adding my route info. - <ol style="list-style: decimal outside;" start="1"><li><route></li><li> <pattern>/{instanceId}/selectedPackageDetail</pattern></li><li> <ignored-parameter name="p_p_mode" /></li><li> <ignored-parameter name="p_auth" /></li><li> <ignored-parameter name="p_p_id" /></li><li> <implicit-parameter name="p_p_lifecycle">0</implicit-parameter></li><li> <implicit-parameter name="mvcRenderCommandName">/userprofileassociates/fetch-package-detail</implicit-parameter></li><li> </route></li></ol>pradip choudhari2020-03-10T13:37:17ZGenerate Friendly URL through programatically Craeted URLpradip choudharihttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1187024322020-03-10T04:41:16Z2020-03-10T04:41:16ZHi everyone , <br />I am learning generating friendly URL , in that I am getting some problems like , If I create my url on tag based then I am getting correctly friendlyURL which I excepected , but If go with programatically URL then Liferay not generating friendly URL .. Anyone faced this issue ? <br /><br /><portlet:renderURL var="testURL"><br /> <portlet:param name="mvcRenderCommandName" value="render/viewData"></portlet:param><br /> <portlet:param name="userName" value="John"></portlet:param><br /></portlet:renderURL><br /><br />In above case I am getting perfectlty friendly URL , But in below case same URL I am creating through Programmatically , then its not generating any friendly URL and I am getting that old large URL only . <br /><br />Layout testLayout = LayoutLocalServiceUtil.getFriendlyURLLayout(themeDisplay.getLayout().getGroup().getGroupId(), true, "/test-URL");<br />LiferayPortletURL testUrl = PortletURLFactoryUtil.create(request, "frienddemoclass",testLayout.getPlid(), PortletRequest.RENDER_PHASE);<br />testUrl .setParameter("userName", "John");<br /><