Default variable value when passing id to url

My site consists of several files and pages.
One of the pages is an order display. I pass the order ID via url, and then parse the passed ID.

register_page(__name__, path_template="/order/<order_id>")

It works, it’s great.
But, if the user goes to the exaple_com/order page without a number, he will see a 404 error.
Is there a way to set a default value for an order? For example, if it is not there, then show the exaple_com/order/0 page, and not a 404 error.
Or just create a separate page that will handle exaple_com/order?

hi @uk141
Regarding the two solutions your propose, for the first one:
If user goes to exaple_com/order with no order ID, maybe you can use Pages’ redirect functionality to redirect them to exaple_com/order/0.

For solution 2:
I would customize the message of the 404 error page (example from @AnnMarieW repo), so it alerts the user to insert an order number.

2 Likes

Sadly, it seems to me that such functionality would be useful.
The redirect looks like a working way out for me. Thank you more =)