Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
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: 329

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
juan meza
RE: [SOLVED] Asset Publisher Friendly url
June 23, 2015 9:22 PM
Answer

juan meza

Rank: Regular Member

Posts: 201

Join Date: January 6, 2014

Recent Posts

in case you dont know how to get instance id or url title, here is with the actual variables:

1#set ($urlarray = $currentURL.split("\?"))
2#set($site = $urlarray.get(0))
3<a href="${site}/-/asset_publisher/$portletDisplay.instanceId/content/$journalArticle.urlTitle">Read More</a> 
Michal Sima
RE: [SOLVED] Asset Publisher Friendly url
June 27, 2016 4:13 AM
Answer

Michal Sima

Rank: New Member

Posts: 23

Join Date: February 27, 2013

Recent Posts

Is it possible to generate such URL but to show a web content from the GLOBAL scope?