Tuesday, November 18, 2014

[Liferay] Show Web Content in a different page using Asset Publisher

Guys,

Sometimes, we get requirements to list all news on one page and then if clicked on title, show their details on another page. We can surely do this using Asset publisher. Simple steps below.

  1. Create a Page for listing - Suppose that page is News.
  2. Add Asset Publisher to the page. In the configuration of Asset publisher - Set "Asset Link Behavior"  to  "View in a Specific Portlet

  3. Now create a new page for details - Suppose that page is News Details
  4. Add Asset publisher to the page. In the configuration of Asset Publisher - Check "Set as the Default Asset Publisher for This Page".

  5. Make sure you select Display style as Full content.
  6. Now create a web content. 
  7. In the create screen, add a display page. In the list of display pages, you should be able to see News Details page enabled.
  8. News Details page appears because we followed step 4.

And that should be it. Now go to your news page and click on title of newly created web content. It should display the web content in news details page. You should be able to see the friendly url in browser navigation bar.

That's it for now. Next post will cover a problem with the above. We could not use special characters in title of web content because then friendly url will contain that special character and browser won't understand where to redirect, so it would either go to home page or stay on the same page.

Until next time. :)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.