elm-pages
elm-pages copied to clipboard
Use url.path |> Path.toAbsolute in the Pages.PageUrl.toUrl function
I believe on line 35 it should be url.path |> Path.toAbsolute
, not toRelative
.
https://github.com/dillonkearns/elm-pages/blob/132430b4473ae58986eb2a59650d86482811ba14/src/Pages/PageUrl.elm#L30-L38
Otherwise with --base=/prefix/
CLI option a function like below would produce something like https://example.comprefix
(without a slash between the host name and the path).
baseUrl : PageUrl -> String
baseUrl url =
{ url
| path = Route.Index |> Route.toPath
, query = Nothing
, fragment = Nothing
}
|> Pages.PageUrl.toUrl
|> Url.toString
Arguably it's wrong of Url.toString
from the elm/url
package to produce this kind of output. Maybe it should insert the slash if there isn't one in the path
field of the Url
record. But I suspect we have a better chance of fixing it here in any reasonable time ;-)