mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-02 22:45:55 +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 :
|
init :
|
||||||
Document metadata view
|
Document metadata view
|
||||||
-> Content
|
-> Content
|
||||||
-> Maybe (ContentJson String)
|
-> Maybe { contentJson : ContentJson String, initialUrl : Url }
|
||||||
-> ContentCache metadata view
|
-> ContentCache metadata view
|
||||||
init document content maybeInitialPageContent =
|
init document content maybeInitialPageContent =
|
||||||
parseMetadata maybeInitialPageContent document content
|
parseMetadata maybeInitialPageContent document content
|
||||||
@ -150,7 +150,7 @@ createBuildError path decodeError =
|
|||||||
|
|
||||||
|
|
||||||
parseMetadata :
|
parseMetadata :
|
||||||
Maybe (ContentJson String)
|
Maybe { contentJson : ContentJson String, initialUrl : Url }
|
||||||
-> Document metadata view
|
-> Document metadata view
|
||||||
-> List ( List String, { extension : String, frontMatter : String, body : Maybe String } )
|
-> List ( List String, { extension : String, frontMatter : String, body : Maybe String } )
|
||||||
-> List ( List String, Result String (Entry metadata view) )
|
-> List ( List String, Result String (Entry metadata view) )
|
||||||
@ -174,11 +174,15 @@ parseMetadata maybeInitialPageContent document content =
|
|||||||
parseContent extension value document
|
parseContent extension value document
|
||||||
in
|
in
|
||||||
case maybeInitialPageContent of
|
case maybeInitialPageContent of
|
||||||
Just initialPageContent ->
|
Just { contentJson, initialUrl } ->
|
||||||
Parsed metadata
|
if initialUrl.path == ("/" ++ String.join "/" path) then
|
||||||
{ body = renderer initialPageContent.body
|
Parsed metadata
|
||||||
, staticData = initialPageContent.staticData
|
{ body = renderer contentJson.body
|
||||||
}
|
, staticData = contentJson.staticData
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
NeedContent extension metadata
|
||||||
|
|
||||||
Nothing ->
|
Nothing ->
|
||||||
NeedContent extension metadata
|
NeedContent extension metadata
|
||||||
|
@ -255,7 +255,7 @@ init :
|
|||||||
init pathKey canonicalSiteUrl document toJsPort viewFn content initUserModel flags url key =
|
init pathKey canonicalSiteUrl document toJsPort viewFn content initUserModel flags url key =
|
||||||
let
|
let
|
||||||
contentCache =
|
contentCache =
|
||||||
ContentCache.init document content contentJson
|
ContentCache.init document content (Maybe.map (\cj -> { contentJson = cj, initialUrl = url }) contentJson)
|
||||||
|
|
||||||
contentJson =
|
contentJson =
|
||||||
flags
|
flags
|
||||||
|
Loading…
Reference in New Issue
Block a user