mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-30 23:06:10 +03:00
Only parse and render content for first page initially, not all pages.
This commit is contained in:
parent
3a4881d002
commit
e2a65eb79e
@ -111,7 +111,7 @@ pagesWithErrors cache =
|
||||
init :
|
||||
Document metadata view
|
||||
-> Content
|
||||
-> Maybe (ContentJson String)
|
||||
-> Maybe { contentJson : ContentJson String, initialUrl : Url }
|
||||
-> ContentCache metadata view
|
||||
init document content maybeInitialPageContent =
|
||||
parseMetadata maybeInitialPageContent document content
|
||||
@ -150,7 +150,7 @@ createBuildError path decodeError =
|
||||
|
||||
|
||||
parseMetadata :
|
||||
Maybe (ContentJson String)
|
||||
Maybe { contentJson : ContentJson String, initialUrl : Url }
|
||||
-> Document metadata view
|
||||
-> List ( List String, { extension : String, frontMatter : String, body : Maybe String } )
|
||||
-> List ( List String, Result String (Entry metadata view) )
|
||||
@ -174,11 +174,15 @@ parseMetadata maybeInitialPageContent document content =
|
||||
parseContent extension value document
|
||||
in
|
||||
case maybeInitialPageContent of
|
||||
Just initialPageContent ->
|
||||
Parsed metadata
|
||||
{ body = renderer initialPageContent.body
|
||||
, staticData = initialPageContent.staticData
|
||||
}
|
||||
Just { contentJson, initialUrl } ->
|
||||
if initialUrl.path == ("/" ++ String.join "/" path) then
|
||||
Parsed metadata
|
||||
{ body = renderer contentJson.body
|
||||
, staticData = contentJson.staticData
|
||||
}
|
||||
|
||||
else
|
||||
NeedContent extension metadata
|
||||
|
||||
Nothing ->
|
||||
NeedContent extension metadata
|
||||
|
@ -255,7 +255,7 @@ init :
|
||||
init pathKey canonicalSiteUrl document toJsPort viewFn content initUserModel flags url key =
|
||||
let
|
||||
contentCache =
|
||||
ContentCache.init document content contentJson
|
||||
ContentCache.init document content (Maybe.map (\cj -> { contentJson = cj, initialUrl = url }) contentJson)
|
||||
|
||||
contentJson =
|
||||
flags
|
||||
|
Loading…
Reference in New Issue
Block a user