Fórum

[SOLVED] Asset Publisher Friendly url

thumbnail
Francesco Marangi, modificado 13 Anos atrás.

[SOLVED] Asset Publisher Friendly url

New Member Postagens: 9 Data de Entrada: 06/02/09 Postagens Recentes
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

[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

[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:

[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?
thumbnail
Francesco Marangi, modificado 13 Anos atrás.

RE: [SOLVED] Asset Publisher Friendly url

New Member Postagens: 9 Data de Entrada: 06/02/09 Postagens Recentes
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:


#set($page_url = "YOUR_PAGE_URL")
#set($instance_id = "PORTLET_INSTANCE_ID")
${page_url}/-/asset_publisher/${instance_id}/content/${reserved-article-url-title.data}
thumbnail
Brian Scott Schupbach, modificado 11 Anos atrás.

RE: [SOLVED] Asset Publisher Friendly url

Expert Postagens: 329 Data de Entrada: 23/10/08 Postagens Recentes
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, modificado 8 Anos atrás.

RE: [SOLVED] Asset Publisher Friendly url

Regular Member Postagens: 228 Data de Entrada: 06/01/14 Postagens Recentes
in case you dont know how to get instance id or url title, here is with the actual variables:

#set ($urlarray = $currentURL.split("\?"))
#set($site = $urlarray.get(0))
<a href="${site}/-/asset_publisher/$portletDisplay.instanceId/content/$journalArticle.urlTitle">Read More</a>  
Michal Sima, modificado 7 Anos atrás.

RE: [SOLVED] Asset Publisher Friendly url

New Member Postagens: 24 Data de Entrada: 27/02/13 Postagens Recentes
Is it possible to generate such URL but to show a web content from the GLOBAL scope?