From 04d04e7d9ceb966bcef8fb26710b86935224cb29 Mon Sep 17 00:00:00 2001 From: rl-king Date: Thu, 30 Aug 2018 10:31:25 +0200 Subject: [PATCH] Add route builder --- src/Route.elm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Route.elm b/src/Route.elm index a145a2c..1953e64 100644 --- a/src/Route.elm +++ b/src/Route.elm @@ -4,6 +4,7 @@ import Html exposing (..) import Html.Attributes exposing (..) import Json.Decode as Decode import Url exposing (Url) +import Url.Builder as Builder import Url.Parser exposing ((), Parser) @@ -53,10 +54,11 @@ toRouteData route = RouteData "/" "Home" Article id -> - RouteData ("/page/" ++ String.fromInt id) ("Page " ++ String.fromInt id) + RouteData (Builder.absolute [ "page", String.fromInt id ] []) + ("Page " ++ String.fromInt id) NotFound -> - RouteData "/404" "Not found" + RouteData (Builder.absolute [ "404" ] []) "Not found" toTitle : Route -> String