From aafd5a29e5bbc08833c1b3246066daa88cbd7187 Mon Sep 17 00:00:00 2001 From: Dillon Kearns Date: Wed, 21 Jul 2021 14:53:27 -0700 Subject: [PATCH] Rename frontmatter to route. --- generator/src/SharedTemplate.elm | 2 +- generator/src/generate-template-module-connector.js | 4 ++-- generator/template/src/Shared.elm | 3 ++- src/Pages/Internal/Platform.elm | 2 +- src/Pages/Internal/Platform/Cli.elm | 12 ++++++------ src/Pages/ProgramConfig.elm | 2 +- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/generator/src/SharedTemplate.elm b/generator/src/SharedTemplate.elm index ff9dd00a..43ea80b2 100644 --- a/generator/src/SharedTemplate.elm +++ b/generator/src/SharedTemplate.elm @@ -30,7 +30,7 @@ type alias SharedTemplate msg sharedModel sharedData sharedMsg mappedMsg = sharedData -> { path : Path - , frontmatter : Maybe Route + , route : Maybe Route } -> sharedModel -> (msg -> mappedMsg) diff --git a/generator/src/generate-template-module-connector.js b/generator/src/generate-template-module-connector.js index 69394400..8ef94131 100644 --- a/generator/src/generate-template-module-connector.js +++ b/generator/src/generate-template-module-connector.js @@ -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) => diff --git a/generator/template/src/Shared.elm b/generator/template/src/Shared.elm index 7cb80402..0bf670cc 100644 --- a/generator/template/src/Shared.elm +++ b/generator/template/src/Shared.elm @@ -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) diff --git a/src/Pages/Internal/Platform.elm b/src/Pages/Internal/Platform.elm index f8dff0d2..96dce17b 100644 --- a/src/Pages/Internal/Platform.elm +++ b/src/Pages/Internal/Platform.elm @@ -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 diff --git a/src/Pages/Internal/Platform/Cli.elm b/src/Pages/Internal/Platform/Cli.elm index 702d5b1a..96a8f93f 100644 --- a/src/Pages/Internal/Platform/Cli.elm +++ b/src/Pages/Internal/Platform/Cli.elm @@ -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 = diff --git a/src/Pages/ProgramConfig.elm b/src/Pages/ProgramConfig.elm index 2d571770..f2f3297f 100644 --- a/src/Pages/ProgramConfig.elm +++ b/src/Pages/ProgramConfig.elm @@ -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