I'm using friendly url's in Liferay 6.1
This is in friendly-url-routes.xml
<routes>
<route>
<pattern>/{instanceId}</pattern>
<generated-parameter name="search">{search}</generated-parameter>
<generated-parameter name="sort">{sort}</generated-parameter>
</route>
</routes>
When the param "search" is null or an empty string the routing is completely ignored and the full url is shown instead of the friendly url. When it has a value the url is in the friendly format.
Is there anything I can do to make the url be in the friendly format even if a parameter has no value? Is there a way to hide the parameter even if its value is empty but still in the url?
I have found the answer. If the tag <generated-parameter>
is used then that parameter will have to have a value in the url. If there isn't then the original url is shown instead of the friendly format.
The tag I needed was the <ignored-parameter>
. What this does is it simply doesn't include the parameter in the friendly url whether or not it has a value.
I was initially confused by the name of this tag and I thought the value of the parameter will be ignored but the url is still working as it should and the parameters are persisted between pages but not shown.