Foros de discusión

add friendly URL to blog

Johny black, modificado hace 12 años.

add friendly URL to blog

New Member Mensajes: 20 Fecha de incorporación: 6/03/12 Mensajes recientes
I have liferay blog. When I click on the blog entry a detailed URL comes up. I'm trying to change the URL from something like this

http://localhost.super.com:8080/web/simpleblogs/home/-/blogs/johny-s-blog?_33_redirect=http%3A%2F%2Flocalhost.super.com%3A8080%2Fweb%2Fsimpleblogs%2Fhome%3Fp_p_id%3D33%26p_p_lifecycle%3D0%26p_p_state%3Dnormal%26p_p_mode%3Dview%26p_p_col_id%3Dcolumn-1%26p_p_col_count%3D1

to something like this.

http://localhost.wm.com:8080/web/simpleblogs/home/-/blogs/johny-s-blog

Can this be done? I basically don't want any params showing up in the URL.
thumbnail
Juhi Kumari, modificado hace 12 años.

RE: add friendly URL to blog

Expert Mensajes: 347 Fecha de incorporación: 12/12/11 Mensajes recientes
Hi

You can achieve this using friendly url. See this wiki .
Hope it will useful for you.

Regards
Juhi
Johny black, modificado hace 12 años.

RE: add friendly URL to blog

New Member Mensajes: 20 Fecha de incorporación: 6/03/12 Mensajes recientes
Juhi Kumari:
Hi

You can achieve this using friendly url. See this wiki .
Hope it will useful for you.

Regards
Juhi



In this WIKI it says to modify

liferay-portlet.xml #

Here is an excerpt of /portal-web/docroot/WEB-INF/liferay-portlet.xml/


but I can't find portal-web under tomcat-7.0.23/webapps

Is the location different in 6.1? or am I looking in the wrong place?
thumbnail
Mayur Patel, modificado hace 12 años.

RE: add friendly URL to blog

Expert Mensajes: 358 Fecha de incorporación: 17/11/10 Mensajes recientes
Johny, the location is different one , you've to do modification here,

\tomcat-6.0.32\webapps\ROOT\WEB-INF\liferay-portlet.xml\


Thanks
Johny black, modificado hace 12 años.

RE: add friendly URL to blog

New Member Mensajes: 20 Fecha de incorporación: 6/03/12 Mensajes recientes
Mayur Patel:
Johny, the location is different one , you've to do modification here,

\tomcat-6.0.32\webapps\ROOT\WEB-INF\liferay-portlet.xml\


Thanks



Thank you Mayur, I was able to find this file but now I have a new issue. I can't seem to find

<friendly-url-routes>com/liferay/portlet/blogs/blogs-friendly-url-routes.xml</friendly-url-routes>

blogs-friendly-url-routes.xml


Is this part of a JAR? if so do you know which one?
thumbnail
Mayur Patel, modificado hace 12 años.

RE: add friendly URL to blog

Expert Mensajes: 358 Fecha de incorporación: 17/11/10 Mensajes recientes
Johny, you wanted to do it for Blogs portlet so look at <portlet-name>33</portlet-name> in liferay-portlet.xml

it contains entry which u r finding that is ,

<friendly-url-routes>com/liferay/portlet/blogs/blogs-friendly-url-routes.xml</friendly-url-routes>

and I'm checking same thing in Liferay 6.0E source, I'm not sure about Liferay 6.1E

Thanks
Johny black, modificado hace 12 años.

RE: add friendly URL to blog

New Member Mensajes: 20 Fecha de incorporación: 6/03/12 Mensajes recientes
Mayur Patel:
Johny, you wanted to do it for Blogs portlet so look at <portlet-name>33</portlet-name> in liferay-portlet.xml

it contains entry which u r finding that is ,

<friendly-url-routes>com/liferay/portlet/blogs/blogs-friendly-url-routes.xml</friendly-url-routes>

and I'm checking same thing in Liferay 6.0E source, I'm not sure about Liferay 6.1E

Thanks


My apologies. I meant to say that I cant find the file blogs-friendly-url-routes.xml.

This is the file I need to look into and make modifications in. Can you tell me where I can find this file (blogs-friendly-url-routes.xml)


Thanks.
thumbnail
Hitoshi Ozawa, modificado hace 12 años.

RE: add friendly URL to blog

Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
I meant to say that I cant find the file blogs-friendly-url-routes.xml.


That's in the following directory in Liferay's source code:
\portal-impl\src\com\liferay\portlet\blogs

When Liferay is build from the source, it'll be included in webapps\ROOT\WEB-INF\lib\portal-impl.jar
Johny black, modificado hace 12 años.

RE: add friendly URL to blog

New Member Mensajes: 20 Fecha de incorporación: 6/03/12 Mensajes recientes
Thanks Hitoshi, that is exactly what I was looking for.
Johny black, modificado hace 12 años.

RE: add friendly URL to blog

New Member Mensajes: 20 Fecha de incorporación: 6/03/12 Mensajes recientes
I'm running into an issue. I'm using Liferay 6.1 I have liferay blog portlet and trying to use Friendly URL but unsuccessful.
The info on the WIKI

http://www.liferay.com/web/connor.mckay/blog/-/blogs/5262286

It only states that to hide p_p_mode set it to normal Which I've done. I also tried
putting

<ignored-parameter name="p_p_lifecycle" />
<overridden-parameter name="p_p_lifecycle">1</overridden-parameter>

in my routes for /blogs/view and /blogs/view_entry struts action. Can someone tell me what I need to replace or delete so I don't see additonal p_p_ params

This is the original blogs-friendly-url-routes.xml

<?xml version="1.0"?>
<!DOCTYPE routes PUBLIC "-//Liferay//DTD Friendly URL Routes 6.1.0//EN" "http://www.liferay.com/dtd/liferay-friendly-url-routes_6_1_0.dtd">

<routes>
<route>
<pattern></pattern>
<implicit-parameter name="p_p_lifecycle">0</implicit-parameter>
<implicit-parameter name="p_p_state">normal</implicit-parameter>
<implicit-parameter name="struts_action">/blogs/view</implicit-parameter>
</route>
<route>
<pattern>/maximized</pattern>
<implicit-parameter name="p_p_lifecycle">0</implicit-parameter>
<implicit-parameter name="p_p_state">maximized</implicit-parameter>
<implicit-parameter name="struts_action">/blogs/view</implicit-parameter>
</route>
<route>
<pattern>/rss</pattern>
<ignored-parameter name="p_p_cacheability" />
<implicit-parameter name="p_p_lifecycle">2</implicit-parameter>
<implicit-parameter name="struts_action">/blogs/rss</implicit-parameter>
</route>
<route>
<pattern>/trackback/{entryId:\d+}</pattern>
<implicit-parameter name="p_p_lifecycle">1</implicit-parameter>
<implicit-parameter name="p_p_state">exclusive</implicit-parameter>
<implicit-parameter name="struts_action">/blogs/trackback</implicit-parameter>
</route>
<route>
<pattern>/trackback/{entryId:\d+}/{p_p_state}</pattern>
<implicit-parameter name="p_p_lifecycle">1</implicit-parameter>
<implicit-parameter name="struts_action">/blogs/trackback</implicit-parameter>
</route>
<route>
<pattern>/trackback/{urlTitle}</pattern>
<implicit-parameter name="p_p_lifecycle">1</implicit-parameter>
<implicit-parameter name="p_p_state">exclusive</implicit-parameter>
<implicit-parameter name="struts_action">/blogs/trackback</implicit-parameter>
</route>
<route>
<pattern>/rss/{p_p_state}</pattern>
<implicit-parameter name="p_p_lifecycle">1</implicit-parameter>
<implicit-parameter name="struts_action">/blogs/rss</implicit-parameter>
</route>
<route>
<pattern>/trackback/{urlTitle}/{p_p_state}</pattern>
<implicit-parameter name="p_p_lifecycle">1</implicit-parameter>
<implicit-parameter name="struts_action">/blogs/trackback</implicit-parameter>
</route>
<route>
<pattern>/{entryId:\d+}</pattern>
<implicit-parameter name="p_p_lifecycle">0</implicit-parameter>
<implicit-parameter name="p_p_state">normal</implicit-parameter>
<implicit-parameter name="struts_action">/blogs/view_entry</implicit-parameter>
</route>
<route>
<pattern>/{entryId:\d+}/{p_p_state}</pattern>
<implicit-parameter name="p_p_lifecycle">0</implicit-parameter>
<implicit-parameter name="struts_action">/blogs/view_entry</implicit-parameter>
</route>
<route>
<pattern>/{urlTitle}</pattern>
<implicit-parameter name="p_p_lifecycle">0</implicit-parameter>
<implicit-parameter name="p_p_state">normal</implicit-parameter>
<implicit-parameter name="struts_action">/blogs/view_entry</implicit-parameter>
</route>
<route>
<pattern>/{urlTitle}/{p_p_state}</pattern>
<implicit-parameter name="p_p_lifecycle">0</implicit-parameter>
<implicit-parameter name="struts_action">/blogs/view_entry</implicit-parameter>
</route>
</routes>
thumbnail
Mayur Patel, modificado hace 12 años.

RE: add friendly URL to blog

Expert Mensajes: 358 Fecha de incorporación: 17/11/10 Mensajes recientes
Hi Johny,

Routes support two advanced features that make them even more flexible. The ignored-parameter option forces a parameter to never be shown in the query string. The overridden-parameter options always sets a parameter to the given value when a URL is parsed, but does not set any requirements on the contents of the portlet URL parameters when a URL is generated.


you can remove same by using ignored-parameter in matching routes in your case that is for /blogs/view and /blogs/view_entry.

for ex.
<ignored-parameter name="p_p_col_id" />
<ignored-parameter name="p_p_col_count" />
<ignored-parameter name="p_p_mode" />
<ignored-parameter name="p_p_state" />
<ignored-parameter name="p_p_lifecycle" />


you can add something like below for adding additional attributes if you want,

<route>
<pattern>/{parm1}</pattern>
<generated-parameter name="parm1">/{parm1}</generated-parameter>
</route>


Below link may give you some idea,
http://www.liferay.com/community/forums/-/message_boards/message/8177475

Thanks
Xav NYC, modificado hace 11 años.

RE: add friendly URL to blog

New Member Mensajes: 23 Fecha de incorporación: 27/09/12 Mensajes recientes
Hi,

I want to make sure I understand it properly.
Does this mean that to activate friendly urls for standard liferay portlets we have to modify an xml configuration file embedded in portal-imlp.jar?
Sounds like a bit of a pain for something that I'm sure most people want to do.
It would make more sense in my opinion to have the friendly-url-routes.xml files reside outside the jar.

X.
Xav NYC, modificado hace 11 años.

RE: add friendly URL to blog

New Member Mensajes: 23 Fecha de incorporación: 27/09/12 Mensajes recientes
Hi,

I managed to change the xxx-friendly-url-routes.xml for blogs and wiki and it works.
However I'm struggling now with document-library-display-friendly-url-routes.xml
What should I put in the file to have a friendly url?

How about the other main portlets, like asset publisher, journal content, et.c
Does anyone have a set of working xxx-friendly-url-routes.xml files for Liferay 6.1?

Thanks in advance.
X.
Naga Surya Dhanunjaya Rao Sriapthy, modificado hace 11 años.

RE: add friendly URL to blog

New Member Mensajes: 14 Fecha de incorporación: 25/04/09 Mensajes recientes
Hi,

Is there any way to do hot deploy these changes of blogs-friendly-url-routes.xml instead of changing in portal-impl or ext-impl?

Thanks in advance.

Dhanunjay.
thumbnail
Florencia Hernández, modificado hace 12 años.

RE: add friendly URL to blog

Regular Member Mensajes: 146 Fecha de incorporación: 27/03/12 Mensajes recientes
Hi Johny,

You have to replace the blogs-friendly-url-routes.xml file with this one:


<!--?xml version="1.0"?-->


<routes>
	<route>
		<pattern></pattern>
		<ignored-parameter name="redirect" />
		<implicit-parameter name="p_p_lifecycle">0</implicit-parameter>
		<implicit-parameter name="p_p_state">normal</implicit-parameter>
		<implicit-parameter name="struts_action">/blogs/view</implicit-parameter>
	</route>
	<route>
		<pattern>/maximized</pattern>
		<ignored-parameter name="redirect" />
		<implicit-parameter name="p_p_lifecycle">0</implicit-parameter>
		<implicit-parameter name="p_p_state">maximized</implicit-parameter>
		<implicit-parameter name="struts_action">/blogs/view</implicit-parameter>
	</route>
	<route>
		<pattern>/rss</pattern>
		<ignored-parameter name="redirect" />
		<ignored-parameter name="p_p_cacheability" />
		<implicit-parameter name="p_p_lifecycle">2</implicit-parameter>
		<implicit-parameter name="struts_action">/blogs/rss</implicit-parameter>
	</route>
	<route>
		<pattern>/trackback/{entryId:\d+}</pattern>
		<ignored-parameter name="redirect" />
		<implicit-parameter name="p_p_lifecycle">1</implicit-parameter>
		<implicit-parameter name="p_p_state">exclusive</implicit-parameter>
		<implicit-parameter name="struts_action">/blogs/trackback</implicit-parameter>
	</route>
	<route>
		<pattern>/trackback/{entryId:\d+}/{p_p_state}</pattern>
		<ignored-parameter name="redirect" />
		<implicit-parameter name="p_p_lifecycle">1</implicit-parameter>
		<implicit-parameter name="struts_action">/blogs/trackback</implicit-parameter>
	</route>
	<route>
		<pattern>/trackback/{urlTitle}</pattern>
		<ignored-parameter name="redirect" />
		<implicit-parameter name="p_p_lifecycle">1</implicit-parameter>
		<implicit-parameter name="p_p_state">exclusive</implicit-parameter>
		<implicit-parameter name="struts_action">/blogs/trackback</implicit-parameter>
	</route>
	<route>
		<pattern>/rss/{p_p_state}</pattern>
		<ignored-parameter name="redirect" />
		<implicit-parameter name="p_p_lifecycle">1</implicit-parameter>
		<implicit-parameter name="struts_action">/blogs/rss</implicit-parameter>
	</route>
	<route>
		<pattern>/trackback/{urlTitle}/{p_p_state}</pattern>
		<ignored-parameter name="redirect" />
		<implicit-parameter name="p_p_lifecycle">1</implicit-parameter>
		<implicit-parameter name="struts_action">/blogs/trackback</implicit-parameter>
	</route>
	<route>
		<pattern>/{entryId:\d+}</pattern>
		<ignored-parameter name="redirect" />
		<implicit-parameter name="p_p_lifecycle">0</implicit-parameter>
		<implicit-parameter name="p_p_state">normal</implicit-parameter>
		<implicit-parameter name="struts_action">/blogs/view_entry</implicit-parameter>
	</route>
	<route>
		<pattern>/{entryId:\d+}/{p_p_state}</pattern>
		<ignored-parameter name="redirect" />
		<implicit-parameter name="p_p_lifecycle">0</implicit-parameter>
		<implicit-parameter name="struts_action">/blogs/view_entry</implicit-parameter>
	</route>
	<route>
		<pattern>/{urlTitle}</pattern>
		<ignored-parameter name="redirect" />
		<implicit-parameter name="p_p_lifecycle">0</implicit-parameter>
		<implicit-parameter name="p_p_state">normal</implicit-parameter>
		<implicit-parameter name="struts_action">/blogs/view_entry</implicit-parameter>
	</route>
	<route>
		<pattern>/{urlTitle}/{p_p_state}</pattern>
		<ignored-parameter name="redirect" />
		<implicit-parameter name="p_p_lifecycle">0</implicit-parameter>
		<implicit-parameter name="struts_action">/blogs/view_entry</implicit-parameter>
	</route>
</routes>


And your url will look just the way you want.
Bella fernandis, modificado hace 11 años.

RE: add friendly URL to blog

New Member Mensajes: 15 Fecha de incorporación: 6/11/12 Mensajes recientes
Thanks Florencia Gadea for your help. I successfully updated the url to localhost:8080/blog/-/blogs/testing. But what if i want to remove the "-" from the url??
I want the url to be localhost:8080/blog/blogs/testing. Can you please help me with this??
thumbnail
Tina Agrawal, modificado hace 8 años.

RE: add friendly URL to blog

Expert Mensajes: 297 Fecha de incorporación: 3/01/08 Mensajes recientes
Hi Florencia,

I have done exactly the same thing using ext plugin and also tried changing it directly in portal-impl.jar but nothing seems to work.
Restarted the server couple of times. Not sure what could be the issue.

Any suggestions.

Tina