Rename frontmatter to route.

This commit is contained in:
Dillon Kearns 2021-07-21 14:53:27 -07:00
parent 182fb89ddf
commit aafd5a29e5
6 changed files with 13 additions and 12 deletions

View File

@ -30,7 +30,7 @@ type alias SharedTemplate msg sharedModel sharedData sharedMsg mappedMsg =
sharedData
->
{ path : Path
, frontmatter : Maybe Route
, route : Maybe Route
}
-> sharedModel
-> (msg -> mappedMsg)

View File

@ -129,7 +129,7 @@ type PageData
view :
{ path : Path
, frontmatter : Maybe Route
, route : Maybe Route
}
-> Maybe PageUrl
-> Shared.Data
@ -139,7 +139,7 @@ view :
, head : List Head.Tag
}
view page maybePageUrl globalData pageData =
case ( page.frontmatter, pageData ) of
case ( page.route, pageData ) of
${templates
.map(
(name) =>

View File

@ -6,6 +6,7 @@ import Html exposing (Html)
import Pages.Flags
import Pages.PageUrl exposing (PageUrl)
import Path exposing (Path)
import Route exposing (Route)
import SharedTemplate exposing (SharedTemplate)
import View exposing (View)
@ -88,7 +89,7 @@ view :
Data
->
{ path : Path
, frontmatter : route
, route : Maybe Route
}
-> Model
-> (Msg -> msg)

View File

@ -48,7 +48,7 @@ mainView config model =
Ok pageData ->
(config.view
{ path = ContentCache.pathForUrl urls |> Path.join
, frontmatter = config.urlToRoute model.url
, route = config.urlToRoute model.url
}
Nothing
pageData.sharedData

View File

@ -710,7 +710,7 @@ nextStepToEffect contentCache config model ( updatedStaticResponsesModel, nextSt
, query = Nothing
, fragment = Nothing
}
, metadata = currentPage.frontmatter
, metadata = currentPage.route
, pageUrl = Nothing
}
)
@ -733,9 +733,9 @@ nextStepToEffect contentCache config model ( updatedStaticResponsesModel, nextSt
-- |> Maybe.withDefault Dict.empty
Dict.empty
currentPage : { path : Path, frontmatter : route }
currentPage : { path : Path, route : route }
currentPage =
{ path = payload.path, frontmatter = config.urlToRoute currentUrl }
{ path = payload.path, route = config.urlToRoute currentUrl }
pageDataResult : Result BuildError pageData
pageDataResult =
@ -866,7 +866,7 @@ sendSinglePageProgress toJsPayload config model =
, query = Nothing
, fragment = Nothing
}
, metadata = currentPage.frontmatter
, metadata = currentPage.route
, pageUrl = Nothing
}
)
@ -898,9 +898,9 @@ sendSinglePageProgress toJsPayload config model =
|> Dict.get (Path.toRelative page)
|> Maybe.withDefault Dict.empty
currentPage : { path : Path, frontmatter : route }
currentPage : { path : Path, route : route }
currentPage =
{ path = page, frontmatter = config.urlToRoute currentUrl }
{ path = page, route = config.urlToRoute currentUrl }
pageDataResult : Result BuildError pageData
pageDataResult =

View File

@ -39,7 +39,7 @@ type alias ProgramConfig userMsg userModel route siteData pageData sharedData =
, data : route -> DataSource.DataSource pageData
, view :
{ path : Path
, frontmatter : route
, route : route
}
-> Maybe PageUrl
-> sharedData