elm-pages icon indicating copy to clipboard operation
elm-pages copied to clipboard

Issue with only catch-all routing

Open shahnhogan opened this issue 1 year ago • 0 comments

I'm working on a site that needs the first segment of the path to be a language such as /en-gb, /es, /fr-ca, etc. When visiting these pages you get pages translated to the language in the URL. If the URL doesn't start with a supported language then we default to English. My issue is to support this I believe the entire site needs to be configured as catch-all routing. This would require two file-based routes Route.Index and Route.SPLAT_ according to the documentation. However, when I removed the Route folder and used npx elm-pages@latest run Addroute Index and another for SPLAT_ I get the following error when running npm run start. I'm on elm-pages 3.0.9 according to npx elm-pages --version.

-- REDUNDANT PATTERN --------------- /Users/shahnhogan/explorations/elm-pages-slugger/elm-stuff/elm-pages/.elm-pages/Route.elm
The 3rd pattern is redundant:

24|     case segments of
25|     [] ->
26|         Just Index
27| 
28|     splatFirst :: splatRest ->
29|         Just (SPLAT_ { splat = ( splatFirst, splatRest ) })
30| 
31|>    _ ->
32|         Nothing

Any value with this shape will be handled by a previous pattern, so it should be
removed.

shahnhogan avatar Jul 26 '23 23:07 shahnhogan