RE: RE: Possibility to reserve an url following a regex

thumbnail
Eric D, modified 15 Days ago. Junior Member Posts: 59 Join Date: 3/25/16 Recent Posts

Hello,
I am trying to configure a route in my angular customElement, but if I change the url, Liferay think I am in an other page.
Example, we have a page /contracts where we can see a list of all the contracts and we want to see the detail of a contract 12 in the page /contracts/12, Liferay try to find this page but we want to stay on the page /contracts with the url /contracts/12 and our angular app will show the detail of the contract 12.
Is it possible to ignore the end of an url ?
For a site we can redirect or create alias but we want to do this for all our sites (we have a site template)
It would be great if a customElement can "reserve" an url matching a regex like we can do with a standard portlet (friendlyurl route)

Eric.

thumbnail
Eric D, modified 2 Years ago. New Member Posts: 4 Join Date: 4/19/20 Recent Posts

Hello Eric,

When you register a custom element, you can set a friendly URL mapping.

Suppose you pur "foo" in that field, then you will be allowed to implement a router supporting this kind of URLs:

http://localhost:8080/web/guest/home/-/foo/contracts/12

/-/ is the friendly URL separator which makes it possible for Liferay to identify where the layout part of the URL ends.

When you register such friendly URL mapping for custom elements, the page will not reload when you follow links with that pattern.

Kind regards,

Fabian

thumbnail
Eric D, modified 15 Days ago. Junior Member Posts: 59 Join Date: 3/25/16 Recent Posts

Yes, it is exactly what we want.

It now works for us.

 

Thanks Fabian.