Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Brian Scott Schupbach
Change asset publisher to display friendly URLs that are ONLY the title?
September 20, 2012 6:43 AM
Answer

Brian Scott Schupbach

Rank: Expert

Posts: 329

Join Date: October 23, 2008

Recent Posts

I need the asset publisher to only display titles instead of something like this before the title "/-/asset_publisher/NqaVobJd3810/content/" . Is this possible?

So, for example, if I have a web content title of "Here is my title", then I would like the URL to be http://mysite.com/here-is-my-title instead of http://mysite.com/-/asset_publisher/NqaVobJd3810/content/here-is-my-title

Any help on how to get started on this would be greatly appreciated.

Thank you,

Brian
Brian Scott Schupbach
RE: Change asset publisher to display friendly URLs that are ONLY the title
September 21, 2012 5:52 AM
Answer

Brian Scott Schupbach

Rank: Expert

Posts: 329

Join Date: October 23, 2008

Recent Posts

Looks like this is already existing..

First you'll need to create a page and add the asset publisher to it. In the configuration options you'll need to check the box next to the option that sets the asset publisher as the default publisher for the page. Then when creating your piece of web content click on the "display page" option and select the page you just created. After the content has been published it can be added to any other asset publishers on the site and it will open up with a friendly URL on the page you specified.

Brian
Peter Kowski
RE: Change asset publisher to display friendly URLs that are ONLY the title
October 4, 2012 1:46 AM
Answer

Peter Kowski

Rank: Junior Member

Posts: 26

Join Date: August 1, 2012

Recent Posts

Hi Brian. This is really neat functionality and something I am trying to make more use of as well. However what I am trying to do is to further enrich my friendly URL's by adding some more depth to them. e.g. Using the example you have, we now know that these 2 URL's are the same:
http://mysite.com/-/here-is-my-title
http://mysite.com/-/asset_publisher/NqaVobJd3810/content/here-is-my-title

What I would ideally like are friendly URL's of the form http://mysite.com/news/-/here-is-my-title and http://mysite.com/sports/-/here-is-another-title

Do you (or anybody else) know how this could be achieved? I presume I would have to make use of some sort of a hook or find some other way of modifying the asset publesher friendly URLs.
Brian Scott Schupbach
RE: Change asset publisher to display friendly URLs that are ONLY the title
October 4, 2012 6:54 PM
Answer

Brian Scott Schupbach

Rank: Expert

Posts: 329

Join Date: October 23, 2008

Recent Posts

Hello,

Checkout the urlrewrite.xml file. From this file you can find the asset publisher where it name spaces the URL by using the '-'. You could then change that to 'sports'. So, then your URL's would look something like mysite.com/sports/here-is-another-title. I haven't done this myself but I believe it is possible. Good luck and let me know how it goes.

Brian
Peter Kowski
RE: Change asset publisher to display friendly URLs that are ONLY the title
October 30, 2012 2:16 AM
Answer

Peter Kowski

Rank: Junior Member

Posts: 26

Join Date: August 1, 2012

Recent Posts

Hi Brian, Thanks for the tip. I still haven't managed to do what you suggested, but I think this looks like a global change. (i.e. the word "sports" would apply to all web contents). In any case, I will let you know how it goes.

I have another question related to these friendly URL's for web contents. Do you have any idea on how I can force a 404 if a web content is not found. At the moment, by default, a petiton to www.site.com/-/a-web-content-that-does-not-exist gets redirected to the home page. This effectively gives the site an infinite number of URLs for the home page (which is not very SEO friendly).
Brian Scott Schupbach
RE: Change asset publisher to display friendly URLs that are ONLY the title
October 30, 2012 1:47 PM
Answer

Brian Scott Schupbach

Rank: Expert

Posts: 329

Join Date: October 23, 2008

Recent Posts

What version are you using? I'm not having this issue with 6.1 GA1

Thanks,

Brian
Jan Hapunkt
RE: Change asset publisher to display friendly URLs that are ONLY the title
December 17, 2012 1:52 AM
Answer

Jan Hapunkt

Rank: New Member

Posts: 1

Join Date: December 17, 2012

Recent Posts

Hi! I installed a new liferay from scratch, created a site "test" und put an assetpublisher on it.. I went to configuration and set the "default" option als mentioned. I also tagged related the "what-we-do" article to this site.

If I open the "what-we-do" article, I got this url:

localhost:8080/web/guest/test/-/asset_publisher/2synJuNhurC3/content/what-we-do?redirect=http%3A%2F%2Fwww.iftportal.de%3A8080%2Fweb%2Fguest%2Ftest%3Fp_p_id%3D101_INSTANCE_2synJuNhurC3%26p_p_lifecycle%3D0%26p_p_state%3Dnormal%26p_p_mode%3Dview%26p_p_col_id%3Dcolumn-2%26p_p_col_count%3D1

In your post, you told I could now use this url instead:

http://www.iftportal.de:8080/web/guest/test/-/what-we-do

but this doesnt work...

what am I doing wrong?
Brian Scott Schupbach
RE: Change asset publisher to display friendly URLs that are ONLY the title
December 27, 2012 6:05 AM
Answer

Brian Scott Schupbach

Rank: Expert

Posts: 329

Join Date: October 23, 2008

Recent Posts

Hi Jan,

You'll need to add an asset publisher to a page and then in the configuration select that it is the default asset publisher for the page. Then when you're editing your web content choose the "display page" link on the right-hand menu and select the page you created with the asset publisher on it. Now when you click on the article from another asset publisher it will display with the friendly URL on the new page.