Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Brian Scott Schupbach
Change asset publisher to display friendly URLs that are ONLY the title?
20 settembre 2012 6.43
Risposta

Brian Scott Schupbach

Punteggio: Expert

Messaggi: 329

Data di Iscrizione: 23 ottobre 2008

Messaggi recenti

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
21 settembre 2012 5.52
Risposta

Brian Scott Schupbach

Punteggio: Expert

Messaggi: 329

Data di Iscrizione: 23 ottobre 2008

Messaggi recenti

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
4 ottobre 2012 1.46
Risposta

Peter Kowski

Punteggio: Junior Member

Messaggi: 26

Data di Iscrizione: 1 agosto 2012

Messaggi recenti

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
4 ottobre 2012 18.54
Risposta

Brian Scott Schupbach

Punteggio: Expert

Messaggi: 329

Data di Iscrizione: 23 ottobre 2008

Messaggi recenti

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
30 ottobre 2012 2.16
Risposta

Peter Kowski

Punteggio: Junior Member

Messaggi: 26

Data di Iscrizione: 1 agosto 2012

Messaggi recenti

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
30 ottobre 2012 13.47
Risposta

Brian Scott Schupbach

Punteggio: Expert

Messaggi: 329

Data di Iscrizione: 23 ottobre 2008

Messaggi recenti

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
17 dicembre 2012 1.52
Risposta

Jan Hapunkt

Punteggio: New Member

Messaggi: 1

Data di Iscrizione: 17 dicembre 2012

Messaggi recenti

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
27 dicembre 2012 6.05
Risposta

Brian Scott Schupbach

Punteggio: Expert

Messaggi: 329

Data di Iscrizione: 23 ottobre 2008

Messaggi recenti

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.
RAVI RAJAMANI
RE: Change asset publisher to display friendly URLs that are ONLY the title
30 giugno 2016 1.12
Risposta

RAVI RAJAMANI

Punteggio: Junior Member

Messaggi: 69

Data di Iscrizione: 7 dicembre 2014

Messaggi recenti

Hi Brian Scott Schupbach,

This approach will work finely for web-content linked to asset publisher page.

How to achieve for the Blog type in the Asset publisher portlet ?
any customization was required ?
is by a) configuration
b) customization (hook or ext).

Kindly reply.

Regards,
Ravi R