Pierpaolo Cira
Pierpaolo Cira

Reputation: 1477

Liferay page friendly URL generation URL

when I create a page in Liferay (I'm using 6.2) it receive an auto-generated friendly URL, following several internal rule.

So, for example, if I create a page named aaa it will automatically receive /aaa friendly URL.

Also if I create the page "aaa" as a children of the page xxx, it will receive the same /aaa friendly URL.

For SEO issues, I need that will be created following a different pattern: parent_friendlyURL + page_friendlyURL.

This means that, if xxx parent page has /xxx friendly URL, its children aaa should have /xxx/aaa friendly URL, instead of just /aaa.

I searched for portal.properties options, but I don't find any solution to the problem. Do you think a quick way exists to achieve this, or I have to do it by an hook?

Thanks

Upvotes: 1

Views: 968

Answers (1)

rp.
rp.

Reputation: 3465

I've looked through LayoutLocalServiceImpl.java which gets auto-generated links from LayoutLocalServiceHelper.java should the user not pass in a friendlyURL.

So there are 2 approaches you can take.

  1. You can simply edit the friendlyURL of your pages though the admin page.
  2. You can write a hook to wrap the LayoutLocalService class and if the friendlyURL param is null or a blank string, write your own logic to generate the friendlyURL. If you're uncertain how, see this question: How to replace a function on a Liferay native portlet.

Upvotes: 1

Related Questions