mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2025-01-03 17:31:58 +03:00
Use static payload for head function.
This commit is contained in:
parent
40614be38f
commit
d6790c479c
@ -14,8 +14,7 @@ simplest :
|
||||
-> Global.RenderedBody
|
||||
-> Global.PageView templateMsg
|
||||
, head :
|
||||
PagePath Pages.PathKey
|
||||
-> templateMetadata
|
||||
StaticPayload templateMetadata ()
|
||||
-> List (Head.Tag Pages.PathKey)
|
||||
}
|
||||
-> Template templateMetadata () () templateMsg globalMetadata
|
||||
@ -24,7 +23,7 @@ simplest config =
|
||||
{ view =
|
||||
\dynamicPayload allMetadata staticPayload rendered ->
|
||||
config.view allMetadata staticPayload rendered
|
||||
, head = \() -> config.head
|
||||
, head = config.head
|
||||
, staticData = \_ -> StaticHttp.succeed ()
|
||||
, init = \_ -> ( (), Cmd.none )
|
||||
, update = \_ _ _ -> ( (), Cmd.none, Global.NoOp )
|
||||
@ -39,8 +38,7 @@ simpler :
|
||||
-> Global.RenderedBody
|
||||
-> Global.PageView templateMsg
|
||||
, head :
|
||||
PagePath Pages.PathKey
|
||||
-> templateMetadata
|
||||
StaticPayload templateMetadata ()
|
||||
-> List (Head.Tag Pages.PathKey)
|
||||
, init : templateMetadata -> ( templateModel, Cmd templateMsg )
|
||||
, update : templateMetadata -> templateMsg -> templateModel -> ( templateModel, Cmd templateMsg )
|
||||
@ -51,7 +49,7 @@ simpler config =
|
||||
{ view =
|
||||
\dynamicPayload allMetadata staticPayload rendered ->
|
||||
config.view allMetadata staticPayload dynamicPayload.model rendered
|
||||
, head = \() -> config.head
|
||||
, head = config.head
|
||||
, staticData = \_ -> StaticHttp.succeed ()
|
||||
, init = config.init
|
||||
, update = \a1 b1 c1 -> config.update a1 b1 c1 |> (\( a, b ) -> ( a, b, Global.NoOp ))
|
||||
@ -68,9 +66,7 @@ stateless :
|
||||
-> Global.RenderedBody
|
||||
-> Global.PageView templateMsg
|
||||
, head :
|
||||
templateStaticData
|
||||
-> PagePath Pages.PathKey
|
||||
-> templateMetadata
|
||||
StaticPayload templateMetadata templateStaticData
|
||||
-> List (Head.Tag Pages.PathKey)
|
||||
}
|
||||
-> Template templateMetadata templateStaticData () templateMsg globalMetadata
|
||||
@ -97,9 +93,7 @@ template :
|
||||
-> Global.RenderedBody
|
||||
-> Global.PageView templateMsg
|
||||
, head :
|
||||
templateStaticData
|
||||
-> PagePath Pages.PathKey
|
||||
-> templateMetadata
|
||||
StaticPayload templateMetadata templateStaticData
|
||||
-> List (Head.Tag Pages.PathKey)
|
||||
, init : templateMetadata -> ( templateModel, Cmd templateMsg )
|
||||
, update : templateMetadata -> templateMsg -> templateModel -> ( templateModel, Cmd templateMsg, Global.GlobalMsg )
|
||||
@ -125,9 +119,7 @@ type alias Template templateMetadata templateStaticData templateModel templateMs
|
||||
-> Global.RenderedBody
|
||||
-> Global.PageView templateMsg
|
||||
, head :
|
||||
templateStaticData
|
||||
-> PagePath Pages.PathKey
|
||||
-> templateMetadata
|
||||
StaticPayload templateMetadata templateStaticData
|
||||
-> List (Head.Tag Pages.PathKey)
|
||||
, init : templateMetadata -> ( templateModel, Cmd templateMsg )
|
||||
, update : templateMetadata -> templateMsg -> templateModel -> ( templateModel, Cmd templateMsg, Global.GlobalMsg )
|
||||
|
@ -70,8 +70,8 @@ view dynamicPayload allMetadata staticPayload rendered =
|
||||
}
|
||||
|
||||
|
||||
head : StaticData -> PagePath.PagePath Pages.PathKey -> BlogIndex -> List (Head.Tag Pages.PathKey)
|
||||
head static currentPath metadata =
|
||||
head : StaticPayload BlogIndex StaticData -> List (Head.Tag Pages.PathKey)
|
||||
head staticPayload =
|
||||
Seo.summary
|
||||
{ canonicalUrlOverride = Nothing
|
||||
, siteName = "elm-pages"
|
||||
|
@ -135,17 +135,17 @@ view allMetadata staticPayload model rendered =
|
||||
}
|
||||
|
||||
|
||||
head : PagePath.PagePath Pages.PathKey -> BlogPost -> List (Head.Tag Pages.PathKey)
|
||||
head currentPath meta =
|
||||
head : StaticPayload BlogPost () -> List (Head.Tag Pages.PathKey)
|
||||
head staticPayload =
|
||||
Head.structuredData
|
||||
(StructuredData.article
|
||||
{ title = meta.title
|
||||
, description = meta.description
|
||||
, author = StructuredData.person { name = meta.author.name }
|
||||
{ title = staticPayload.metadata.title
|
||||
, description = staticPayload.metadata.description
|
||||
, author = StructuredData.person { name = staticPayload.metadata.author.name }
|
||||
, publisher = StructuredData.person { name = "Dillon Kearns" }
|
||||
, url = SiteConfig.canonicalUrl ++ "/" ++ PagePath.toString currentPath
|
||||
, imageUrl = SiteConfig.canonicalUrl ++ "/" ++ ImagePath.toString meta.image
|
||||
, datePublished = Date.toIsoString meta.published
|
||||
, url = SiteConfig.canonicalUrl ++ "/" ++ PagePath.toString staticPayload.path
|
||||
, imageUrl = SiteConfig.canonicalUrl ++ "/" ++ ImagePath.toString staticPayload.metadata.image
|
||||
, datePublished = Date.toIsoString staticPayload.metadata.published
|
||||
, mainEntityOfPage =
|
||||
StructuredData.softwareSourceCode
|
||||
{ codeRepositoryUrl = "https://github.com/dillonkearns/elm-pages"
|
||||
@ -159,19 +159,19 @@ head currentPath meta =
|
||||
{ canonicalUrlOverride = Nothing
|
||||
, siteName = "elm-pages"
|
||||
, image =
|
||||
{ url = meta.image
|
||||
, alt = meta.description
|
||||
{ url = staticPayload.metadata.image
|
||||
, alt = staticPayload.metadata.description
|
||||
, dimensions = Nothing
|
||||
, mimeType = Nothing
|
||||
}
|
||||
, description = meta.description
|
||||
, description = staticPayload.metadata.description
|
||||
, locale = Nothing
|
||||
, title = meta.title
|
||||
, title = staticPayload.metadata.title
|
||||
}
|
||||
|> Seo.article
|
||||
{ tags = []
|
||||
, section = Nothing
|
||||
, publishedTime = Just (Date.toIsoString meta.published)
|
||||
, publishedTime = Just (Date.toIsoString staticPayload.metadata.published)
|
||||
, modifiedTime = Nothing
|
||||
, expirationTime = Nothing
|
||||
}
|
||||
|
@ -66,8 +66,8 @@ decoder =
|
||||
(Decode.field "title" Decode.string)
|
||||
|
||||
|
||||
head : StaticData -> PagePath.PagePath Pages.PathKey -> Documentation -> List (Head.Tag Pages.PathKey)
|
||||
head static currentPath meta =
|
||||
head : StaticPayload Documentation StaticData -> List (Head.Tag Pages.PathKey)
|
||||
head staticPayload =
|
||||
Seo.summary
|
||||
{ canonicalUrlOverride = Nothing
|
||||
, siteName = "elm-pages"
|
||||
@ -79,7 +79,7 @@ head static currentPath meta =
|
||||
}
|
||||
, description = SiteConfig.tagline
|
||||
, locale = Nothing
|
||||
, title = meta.title
|
||||
, title = staticPayload.metadata.title
|
||||
}
|
||||
|> Seo.website
|
||||
|
||||
|
@ -56,8 +56,8 @@ decoder =
|
||||
(Decode.field "title" Decode.string)
|
||||
|
||||
|
||||
head : PagePath.PagePath Pages.PathKey -> Page -> List (Head.Tag Pages.PathKey)
|
||||
head currentPath meta =
|
||||
head : StaticPayload Page () -> List (Head.Tag Pages.PathKey)
|
||||
head staticPayload =
|
||||
Seo.summary
|
||||
{ canonicalUrlOverride = Nothing
|
||||
, siteName = "elm-pages"
|
||||
@ -69,7 +69,7 @@ head currentPath meta =
|
||||
}
|
||||
, description = SiteConfig.tagline
|
||||
, locale = Nothing
|
||||
, title = meta.title
|
||||
, title = staticPayload.metadata.title
|
||||
}
|
||||
|> Seo.website
|
||||
|
||||
|
@ -59,8 +59,8 @@ view allMetadata static rendered =
|
||||
}
|
||||
|
||||
|
||||
head : StaticData -> PagePath.PagePath Pages.PathKey -> Showcase -> List (Head.Tag Pages.PathKey)
|
||||
head static currentPath metadata =
|
||||
head : StaticPayload Showcase StaticData -> List (Head.Tag Pages.PathKey)
|
||||
head staticPayload =
|
||||
Seo.summary
|
||||
{ canonicalUrlOverride = Nothing
|
||||
, siteName = "elm-pages"
|
||||
|
@ -97,7 +97,12 @@ view siteMetadata page =
|
||||
|
||||
_ ->
|
||||
{ title = "", body = Html.text "" }
|
||||
, head = Template.${name}.template.head data page.path metadata
|
||||
, head = Template.${name}.template.head
|
||||
{ static = data
|
||||
, globalStatic = globalData
|
||||
, metadata = metadata
|
||||
, path = page.path
|
||||
}
|
||||
}
|
||||
)
|
||||
(Template.${name}.template.staticData siteMetadata)
|
||||
|
Loading…
Reference in New Issue
Block a user