0

I have a project I that was dropped onto my lap written in 0.18, when ran it keeps changing the url from a sub url we currently load it from to the base url of the page, for example the elm application is loaded via http://example.com/dah/dah/elm#welcome. After application renders the url switches to http://example.com/#welcome. I would like to make sure the application stays at the url it was loaded at like http://example.com/dah/dah/elm#welcome and not http://example.com/#welcome. Would appreciate anyones feedback if possible

I thought there would be a simple config that would allow me to just say have the application run from base url http://example.com/dah/dah/, I could not find anything, I also looked at documentation https://dmy.fr/elm-0.18-packages/ specific for 0.18, navigation https://package.elm-lang.org/packages/elm-lang/navigation/2.1.0. Not quite sure if that was the right link. I could not find anything relevant.

glennsl
  • 28,186
  • 12
  • 57
  • 75
  • I don't think the Elm runtime knows much about URLs at all (pre-0.19 at least). There are very few "simple config"s in Elm, just a set of basic building blocks for you to build your own app with. If you want the URLs to be different, you have to change them yourself. If it's a conventional app you'll probably have a `Route` module with a function that builds a URL for each route. That's what you have to modify. – glennsl May 22 '19 at 22:07
  • Like this: https://github.com/rtfeldman/elm-spa-example/blob/0.18/src/Route.elm#L46-L81 – glennsl May 22 '19 at 22:08
  • 1
    @glennsl thanks for the response, I found a solution to what I was looking for via elm slack channel, it turns out the elm application I was working with was written with no base urls in mind, so I had to add base urls manually. – JoshTune May 23 '19 at 18:42

0 Answers0