Skip to content
This repository has been archived by the owner on Oct 28, 2019. It is now read-only.

Commit

Permalink
Add route builder
Browse files Browse the repository at this point in the history
  • Loading branch information
rl-king committed Aug 30, 2018
1 parent 67cdc3f commit 04d04e7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Route.elm
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 04d04e7

Please sign in to comment.