Hadi
08/08/2021, 8:08 AMroute("") {
route("/{year}/{month?}/{day?}") {
get {
call.respondHtml{
title { +"title" }
body {
a (href = "$baseUrl/somepath") { +"link to top level" }
}
}
}
}
}
In this example, if I do href="/somepath"
, it will go to different places if month or day is given.Aleksei Tirman [JB]
08/09/2021, 9:58 AMHadi
08/09/2021, 1:03 PMroute("someEndpoint")
and do a (href="/test")
, you will get a link which is /someEndpoint/test
for the href. However, if you want to get to /test
, you need to do a (href="../test")
. This works in a normal route method. But when your route has optional arguments as above, this will give /test
, /year/test
or /year/month/test
if no month and day is given, month is given or month and day are given, respectively.a (href=$baseUrl/test)
it always returns /test
no matter which route your are currently in.Aleksei Tirman [JB]
08/09/2021, 3:45 PMhref = "/test"
then a web browser always points me to <protocol://host>:port/test
no matter what the current URL is, e.g. http://localhost:8080/2020/10/23. Please describe how exactly do you observe such behavior?Hadi
08/09/2021, 5:51 PMinstall(IgnoreTrailingSlash)
, I did not put the leading /
in the path for href
. Without the leading slash it follows current path but with that it goes form the base path. Thanks a lot. 👍