mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-29 18:00:47 +03:00
Ignore trailing slash.
This commit is contained in:
parent
81cd85997b
commit
57f1b6a006
@ -21,7 +21,7 @@ lookup :
|
||||
lookup content url =
|
||||
List.Extra.find
|
||||
(\( path, markup ) ->
|
||||
(String.split "/" url.path
|
||||
(String.split "/" (url.path |> dropTrailingSlash)
|
||||
|> List.drop 1
|
||||
)
|
||||
== path
|
||||
@ -30,6 +30,14 @@ lookup content url =
|
||||
|> Maybe.map Tuple.second
|
||||
|
||||
|
||||
dropTrailingSlash path =
|
||||
if path |> String.endsWith "/" then
|
||||
String.dropRight 1 path
|
||||
|
||||
else
|
||||
path
|
||||
|
||||
|
||||
type alias Content msg =
|
||||
{ posts :
|
||||
List
|
||||
|
Loading…
Reference in New Issue
Block a user