Liferay: Obtain all possible article urls or/and titles

107 Views Asked by At

One article my translated and displayed in many country sites. I am traying to retrieve all possible urls and maybe titles for one article.

Currently I am trying to retrieve them from Layout, but I get back empty list. What I am missing here? Or there is some other possibility?

List<Long> layoutIds = JournalContentSearchLocalServiceUtil.getLayoutIds(groupId, false, articleId)
out.println(layoutIds) // i get empty list
for (Long oneId : layoutIds){
   Layout layout = LayoutLocalServiceUtil.getLayout(groupId, false, oneId)
   String urlFromLayout = layout.getFriendlyURL()}
1

There are 1 best solutions below

0
Olaf Kock On

This won't be a full answer, but it's more than a comment and might set you on the right track (though with a bit of work that you'd need to do by yourself):

When you say "Article": Do you mean a Web Content Article? Such an article can have a "Display Page", a page with its own URL that you can request, showing it fully rendered on a page.

Naming hints for Liferay's Java-API:

  • All of the "Web Content Article" APIs start with Journal, e.g. JournalArticleService
  • A page is called Layout in the API (e.g. LayoutService), multiple pages are contained in a LayoutSet (e.g. a public or private LayoutSet)
  • APIs ending in LocalService contain the low-level access which has no access control, while those ending in Service (but without "Local") are the permission checked equivalents.
  • You might be particularly interested in exploring the LayoutTemplate and LayoutFriendlyURL related APIs

Javadoc likely won't help you much, but here's something to browse on to explore the API.