mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-01 07:45:22 +03:00
Include global head tags in dev server and build output.
This commit is contained in:
parent
2a860a1936
commit
df485eafa3
@ -907,9 +907,16 @@ sendSinglePageProgress toJsPayload config model =
|
|||||||
config.sharedData
|
config.sharedData
|
||||||
(staticData |> Dict.map (\_ v -> Just v))
|
(staticData |> Dict.map (\_ v -> Just v))
|
||||||
|> Result.mapError (StaticHttpRequest.toBuildError currentUrl.path)
|
|> Result.mapError (StaticHttpRequest.toBuildError currentUrl.path)
|
||||||
|
|
||||||
|
siteDataResult : Result BuildError siteData
|
||||||
|
siteDataResult =
|
||||||
|
StaticHttpRequest.resolve ApplicationType.Cli
|
||||||
|
(config.site allRoutes |> .data)
|
||||||
|
(staticData |> Dict.map (\_ v -> Just v))
|
||||||
|
|> Result.mapError (StaticHttpRequest.toBuildError "Site.elm")
|
||||||
in
|
in
|
||||||
case Result.map2 Tuple.pair pageFoundResult renderedResult of
|
case Result.map3 (\a b c -> ( a, b, c )) pageFoundResult renderedResult siteDataResult of
|
||||||
Ok ( pageFound, rendered ) ->
|
Ok ( pageFound, rendered, siteData ) ->
|
||||||
{ route = page |> PagePath.toString
|
{ route = page |> PagePath.toString
|
||||||
, contentJson =
|
, contentJson =
|
||||||
toJsPayload.pages
|
toJsPayload.pages
|
||||||
@ -917,7 +924,7 @@ sendSinglePageProgress toJsPayload config model =
|
|||||||
|> Maybe.withDefault Dict.empty
|
|> Maybe.withDefault Dict.empty
|
||||||
, html = rendered.view
|
, html = rendered.view
|
||||||
, errors = []
|
, errors = []
|
||||||
, head = rendered.head
|
, head = rendered.head ++ (config.site allRoutes |> .head) siteData
|
||||||
, title = rendered.title
|
, title = rendered.title
|
||||||
, staticHttpCache = model.allRawResponses |> Dict.Extra.filterMap (\_ v -> v)
|
, staticHttpCache = model.allRawResponses |> Dict.Extra.filterMap (\_ v -> v)
|
||||||
, is404 = not pageFound
|
, is404 = not pageFound
|
||||||
@ -967,9 +974,16 @@ sendSinglePageProgress toJsPayload config model =
|
|||||||
, query = Nothing
|
, query = Nothing
|
||||||
, fragment = Nothing
|
, fragment = Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
siteDataResult : Result BuildError siteData
|
||||||
|
siteDataResult =
|
||||||
|
StaticHttpRequest.resolve ApplicationType.Cli
|
||||||
|
(config.site allRoutes |> .data)
|
||||||
|
(staticData |> Dict.map (\_ v -> Just v))
|
||||||
|
|> Result.mapError (StaticHttpRequest.toBuildError "Site.elm")
|
||||||
in
|
in
|
||||||
case Result.map2 Tuple.pair sharedDataResult pageDataResult of
|
case Result.map3 (\a b c -> ( a, b, c )) sharedDataResult pageDataResult siteDataResult of
|
||||||
Ok ( sharedData, pageData ) ->
|
Ok ( sharedData, pageData, siteData ) ->
|
||||||
let
|
let
|
||||||
pageModel : userModel
|
pageModel : userModel
|
||||||
pageModel =
|
pageModel =
|
||||||
@ -995,7 +1009,8 @@ sendSinglePageProgress toJsPayload config model =
|
|||||||
|
|
||||||
headTags : List Head.Tag
|
headTags : List Head.Tag
|
||||||
headTags =
|
headTags =
|
||||||
config.view currentPage sharedData pageData |> .head
|
(config.view currentPage sharedData pageData |> .head)
|
||||||
|
++ (siteData |> (config.site allRoutes |> .head))
|
||||||
in
|
in
|
||||||
{ route = page |> PagePath.toString
|
{ route = page |> PagePath.toString
|
||||||
, contentJson =
|
, contentJson =
|
||||||
|
Loading…
Reference in New Issue
Block a user