Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Francesco Marangi
[SOLVED] Asset Publisher Friendly url
January 26, 2011 8:21 AM
Answer

Francesco Marangi

Rank: New Member

Posts: 9

Join Date: February 6, 2009

Recent Posts

Hi everyone,

In previous versions of Liferay, we could display selected articles from a Velocity template in an Asset Publisher by using the friendly URL

1[PAGE_URL]/-/asset_publisher/[PORTLET-INSTANCE-ID]/content/[ARTICLE-ID]


This was working pretty fine.

However, in version 6, the asset publisher is behaving a bit differently, allowing the use of friendly urls for articles.

The new request URL looks like

1[PAGE_URL]/-/asset_publisher/[PORTLET-INSTANCE-ID]/content/[ARTICLE-FRIENLY-URL]


E.g., if the article title is "Liferay Test - This is just a test", the friendly Url looks like:

1[PAGE_URL]/-/asset_publisher/[PORTLET-INSTANCE-ID]/content/liferay-test-this-is-just-a-test


How do I access/generate the Friendly URL for a specific article in Velocity template context?
Francesco Marangi
RE: [SOLVED] Asset Publisher Friendly url
January 26, 2011 8:27 AM
Answer

Francesco Marangi

Rank: New Member

Posts: 9

Join Date: February 6, 2009

Recent Posts

I accidentally found the solution to that. In case anybody is interested, in journal template context, the variable $reserved-article-url-title.data returns exactly the URL title of the article.

To open the article in an asset publisher placed in a different page, you can do something like this:

1
2#set($page_url = "YOUR_PAGE_URL")
3#set($instance_id = "PORTLET_INSTANCE_ID")
4${page_url}/-/asset_publisher/${instance_id}/content/${reserved-article-url-title.data}
Brian Scott Schupbach
RE: [SOLVED] Asset Publisher Friendly url
September 21, 2012 5:53 AM
Answer

Brian Scott Schupbach

Rank: Expert

Posts: 326

Join Date: October 23, 2008

Recent Posts

For an even "friendlier" URL and instructions for version 6.1 checkout this post

http://www.liferay.com/community/forums/-/message_boards/message/16588582