# Does elm-spa not work in github.io pages?

**URL:** <https://discourse.elm-lang.org/t/does-elm-spa-not-work-in-github-io-pages/8894>\
**Category:** Learn\
**Created:** [January 18, 2023, 12:30pm UTC](https://discourse.elm-lang.org/t/does-elm-spa-not-work-in-github-io-pages/8894 "2023-01-18T12:30:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![polarit](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/polarit/32/4651_2.png) [@polarit](https://discourse.elm-lang.org/u/polarit)\
**Post date:** [January 18, 2023, 12:30pm UTC](https://discourse.elm-lang.org/t/does-elm-spa-not-work-in-github-io-pages/8894/1 "2023-01-18T12:30:07Z")

</div>

I tried to upload a short piece of elm-spa to Github Pages.  
It works only on the local host if run with elm-spa server.

the source: [src/Pages/Home\_.elm](https://github.com/jarmol/elmSunPosCalc/blob/master/gospa/src/Pages/Home_.elm)

run with [public/index.html](https://github.com/jarmol/elmSunPosCalc/blob/master/gospa/index.html) successfully using elm-spa server on localhost:1234/

the file [elm.js](https://github.com/jarmol/elmSunPosCalc/blob/master/gospa/dist/elm.js) is built and minimized with elm build

Is this the solution for use in [github.io](http://github.io) , redirect all URLs to [`index.html`](https://tkuriyama.github.io/general/2021/05/27/apache-rewrite-rule.html) ?  
Is [Netifly](https://www.netlify.com/blog/2021/12/13/setting-up-redirects-on-netlify/) more suitable for this purpose?

---

<div class="post-metadata">

**Author:** ![wolfadex](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/wolfadex/32/2461_2.png) [@wolfadex](https://discourse.elm-lang.org/u/wolfadex)\
**Post date:** [January 18, 2023, 6:05pm UTC](https://discourse.elm-lang.org/t/does-elm-spa-not-work-in-github-io-pages/8894/2 "2023-01-18T18:05:02Z")

</div>

I’d probably prefer Netlify as GH Pages hosts your site at `/repo-name` and not at `/`. It makes handling links kind of annoying for anything multipage.

---

<div class="post-metadata">

**Author:** ![polarit](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/polarit/32/4651_2.png) [@polarit](https://discourse.elm-lang.org/u/polarit)\
**Post date:** [January 19, 2023, 8:14am UTC](https://discourse.elm-lang.org/t/does-elm-spa-not-work-in-github-io-pages/8894/3 "2023-01-19T08:14:50Z")

</div>

As I have already [ryannhg/elm-spa](https://package.elm-lang.org/packages/ryannhg/elm-spa/6.0.0) installed, maybe changing it to [Elm Land](https://elm.land/) does not make sense.

One alternative more is orus-io/elm-spa.

However, I would’nt like to stop using of [my GH Pages](https://suncalc.lammi.cc/) because of [Netlify](https://www.netlify.com/blog/2021/12/13/setting-up-redirects-on-netlify/).

---

<div class="post-metadata">

**Author:** ![wolfadex](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/wolfadex/32/2461_2.png) [@wolfadex](https://discourse.elm-lang.org/u/wolfadex)\
**Post date:** [January 19, 2023, 12:15pm UTC](https://discourse.elm-lang.org/t/does-elm-spa-not-work-in-github-io-pages/8894/4 "2023-01-19T12:15:43Z")

</div>

Changing to `orus-io/elm-spa` won’t make this situation any easier. The issue is how GH Pages are hosted. You can change your site around to include that nested routing, but it’s still a pain compared to hosting somewhere else.

Not to dissuade you from trying `orus-io/elm-spa` or Elm Land, both are solid options.

There are alternatives to Netlify as well, such as [http://surge.sh/](http://surge.sh/), [https://vercel.com/](https://vercel.com/), and more.

---

<div class="post-metadata">

**Author:** ![polarit](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/polarit/32/4651_2.png) [@polarit](https://discourse.elm-lang.org/u/polarit)\
**Post date:** [January 19, 2023, 4:09pm UTC](https://discourse.elm-lang.org/t/does-elm-spa-not-work-in-github-io-pages/8894/5 "2023-01-19T16:09:55Z")

</div>

I think, I’ll try one which is easy to use and attractive enough, just for learning purpose. So, maybe Ryan’s elm-spa on mac OS or Elm Land on Ubuntu Linux, both with Netlify.

Thank you for advices given!

---

<div class="post-metadata">

**Author:** ![polarit](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/polarit/32/4651_2.png) [@polarit](https://discourse.elm-lang.org/u/polarit)\
**Post date:** [January 21, 2023, 8:09am UTC](https://discourse.elm-lang.org/t/does-elm-spa-not-work-in-github-io-pages/8894/6 "2023-01-21T08:09:08Z")

</div>

I tried just elm-land on my macOS without installing it (with npx).  
An interesting error appeares when I start the server.

 ![trying_elm-land](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/2X/b/bb21b0c5b65c42d896f798024408180c5921d186.png)

So I’ll continue using elm-spa instead of elm-land in case of macOS.  
Note, elm-land works Ok on my Ubuntu Studio at Intell PC desktop.

---

<div class="post-metadata">

**Author:** ![wolfadex](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/wolfadex/32/2461_2.png) [@wolfadex](https://discourse.elm-lang.org/u/wolfadex)\
**Post date:** [January 21, 2023, 1:30pm UTC](https://discourse.elm-lang.org/t/does-elm-spa-not-work-in-github-io-pages/8894/7 "2023-01-21T13:30:26Z")

</div>

Elm Land has a nice Discord server [Elm Land](https://discord.gg/mcnZFD5W) where people have been sharing their projects and bugs and feature requests, if you’re interested.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [January 31, 2023, 1:30pm UTC](https://discourse.elm-lang.org/t/does-elm-spa-not-work-in-github-io-pages/8894/8 "2023-01-31T13:30:29Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
