留言板
add friendly URL to blog
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.
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.
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?
Johny, the location is different one , you've to do modification here,
\tomcat-6.0.32\webapps\ROOT\WEB-INF\liferay-portlet.xml\
Thanks
\tomcat-6.0.32\webapps\ROOT\WEB-INF\liferay-portlet.xml\
Thanks
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?
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
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
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.
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
Thanks Hitoshi, that is exactly what I was looking for.
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>
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>
Hi Johny,
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.
you can add something like below for adding additional attributes if you want,
Below link may give you some idea,
http://www.liferay.com/community/forums/-/message_boards/message/8177475
Thanks
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
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.
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.
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.
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,修改在11 年前。
RE: add friendly URL to blog
New Member 帖子: 14 加入日期: 09-4-25 最近的帖子
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.
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.
Florencia Hernández,修改在12 年前。
RE: add friendly URL to blog
Regular Member 帖子: 146 加入日期: 12-3-27 最近的帖子
Hi Johny,
You have to replace the blogs-friendly-url-routes.xml file with this one:
And your url will look just the way you want.
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.
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??
I want the url to be localhost:8080/blog/blogs/testing. Can you please help me with this??