How can I get an Liferay Asset Entry's friendly URL to its Display Page?

976 Views Asked by At

I've created a Blog Display Page Template, and marked it as default. Now, from inside a Fragment that has a BlogEntry object, a want to get its Display Page friendly URL.

1

There are 1 best solutions below

0
Marcos Blandim On BEST ANSWER

You can use the getFriendlyURL method from AssetDisplayPageFriendlyURLProvider

[#assign
  assetDisplayPageFriendlyURLProvider = serviceLocator.findService("com.liferay.asset.display.page.portlet.AssetDisplayPageFriendlyURLProvider")
  friendlyURL = assetDisplayPageFriendlyURLProvider.getFriendlyURL(assetEntry.getClassName(), assetEntry.getClassPK(), themeDisplay)
/]
${friendlyURL }