RE: Can a page url include the parent page hierarchy?

thumbnail
Fernando Fernandez, modified 4 Years ago. Expert Posts: 401 Join Date: 8/22/07 Recent Posts

Hi guys,

Normally, when we access a page the url is something like https://hostname/page-friendly-url even if the page is not on the first level on the site builder page hierarchy. I understand the advantage but some customers ask for this, based on SEO arguments.

For example, if we have a homepage called "home" and a sub-page called "sub-home1", the friendly-url will be /sub-home1 and /home/sub-home1 will not work.

Is there any way to make hierarchy-based urls?

I've encountered this case: https://www.liferay.com/resources/case-studies/materion-case-study but I'm not able to reproduce it.

TIA

Fernando

 

thumbnail
Christoph Rabel, modified 4 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts

One of our customers did it manually. He entered parent/child into the page url. Liferay actually accepts that. It isn't nice and needs careful work, but it can be done. Since he only had about 50 or so pages, it was doable manually.

An automatic way would probably be possible too, by hooking the page creation/page update process. E.g. by using a LayoutLocalServiceWrapper and then adjust the url automatically to always add the whole path.

I am not sure if this is a good idea and if there are any caveats (e.g. what happens if the page is moved around, do you fix the path or not?)