Foros de discusión

[SOLVED] Asset Publisher Friendly url

thumbnail
Francesco Marangi, modificado hace 13 años.

[SOLVED] Asset Publisher Friendly url

New Member Mensajes: 9 Fecha de incorporación: 6/02/09 Mensajes recientes
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 hace 13 años.

RE: [SOLVED] Asset Publisher Friendly url

New Member Mensajes: 9 Fecha de incorporación: 6/02/09 Mensajes recientes
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 hace 11 años.

RE: [SOLVED] Asset Publisher Friendly url

Expert Mensajes: 329 Fecha de incorporación: 23/10/08 Mensajes recientes
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 hace 8 años.

RE: [SOLVED] Asset Publisher Friendly url

Regular Member Mensajes: 228 Fecha de incorporación: 6/01/14 Mensajes recientes
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 hace 7 años.

RE: [SOLVED] Asset Publisher Friendly url

New Member Mensajes: 24 Fecha de incorporación: 27/02/13 Mensajes recientes
Is it possible to generate such URL but to show a web content from the GLOBAL scope?