Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Brian Scott Schupbach
Change asset publisher to display friendly URLs that are ONLY the title?
20 de Setembro de 2012 06:43
Resposta

Brian Scott Schupbach

Ranking: Expert

Mensagens: 331

Data de entrada: 23 de Outubro de 2008

Mensagens recentes

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 de Setembro de 2012 05:52
Resposta

Brian Scott Schupbach

Ranking: Expert

Mensagens: 331

Data de entrada: 23 de Outubro de 2008

Mensagens recentes

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 de Outubro de 2012 01:46
Resposta

Peter Kowski

Ranking: Junior Member

Mensagens: 26

Data de entrada: 1 de Agosto de 2012

Mensagens recentes

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 de Outubro de 2012 18:54
Resposta

Brian Scott Schupbach

Ranking: Expert

Mensagens: 331

Data de entrada: 23 de Outubro de 2008

Mensagens recentes

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 de Outubro de 2012 02:16
Resposta

Peter Kowski

Ranking: Junior Member

Mensagens: 26

Data de entrada: 1 de Agosto de 2012

Mensagens recentes

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 de Outubro de 2012 13:47
Resposta

Brian Scott Schupbach

Ranking: Expert

Mensagens: 331

Data de entrada: 23 de Outubro de 2008

Mensagens recentes

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 de Dezembro de 2012 01:52
Resposta

Jan Hapunkt

Ranking: New Member

Mensagens: 1

Data de entrada: 17 de Dezembro de 2012

Mensagens recentes

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 de Dezembro de 2012 06:05
Resposta

Brian Scott Schupbach

Ranking: Expert

Mensagens: 331

Data de entrada: 23 de Outubro de 2008

Mensagens recentes

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.