mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-26 04:31:39 +03:00
Remove siteUrl argument from Pages.application.
This commit is contained in:
parent
51f24dcc9b
commit
3a54c7de1c
@ -111,9 +111,8 @@ combineTupleResults input =
|
||||
init :
|
||||
(String -> view)
|
||||
-> Yaml.Decode.Decoder metadata
|
||||
-> String
|
||||
-> (Json.Encode.Value -> Cmd (Msg userMsg))
|
||||
-> (String -> metadata -> List Head.Tag)
|
||||
-> (metadata -> List Head.Tag)
|
||||
-> Parser metadata view
|
||||
-> Content
|
||||
-> (Flags userFlags -> ( userModel, Cmd userMsg ))
|
||||
@ -121,7 +120,7 @@ init :
|
||||
-> Url
|
||||
-> Browser.Navigation.Key
|
||||
-> ( Model userModel userMsg metadata view, Cmd (Msg userMsg) )
|
||||
init markdownToHtml frontmatterParser siteUrl toJsPort head parser content initUserModel flags url key =
|
||||
init markdownToHtml frontmatterParser toJsPort head parser content initUserModel flags url key =
|
||||
let
|
||||
( userModel, userCmd ) =
|
||||
initUserModel flags
|
||||
@ -180,10 +179,7 @@ init markdownToHtml frontmatterParser siteUrl toJsPort head parser content initU
|
||||
}
|
||||
, Cmd.batch
|
||||
([ Content.lookup okMetadata url
|
||||
|> Maybe.map
|
||||
(head
|
||||
(siteUrl ++ url.path)
|
||||
)
|
||||
|> Maybe.map head
|
||||
|> Maybe.map encodeHeads
|
||||
|> Maybe.map toJsPort
|
||||
, userCmd |> Cmd.map UserMsg |> Just
|
||||
@ -271,15 +267,14 @@ program :
|
||||
, parser : Parser metadata view
|
||||
, content : Content
|
||||
, toJsPort : Json.Encode.Value -> Cmd (Msg userMsg)
|
||||
, head : String -> metadata -> List Head.Tag
|
||||
, siteUrl : String
|
||||
, head : metadata -> List Head.Tag
|
||||
, frontmatterParser : Yaml.Decode.Decoder metadata
|
||||
, markdownToHtml : String -> view
|
||||
}
|
||||
-> Program userFlags userModel userMsg metadata view
|
||||
program config =
|
||||
Browser.application
|
||||
{ init = init config.markdownToHtml config.frontmatterParser config.siteUrl config.toJsPort config.head config.parser config.content config.init
|
||||
{ init = init config.markdownToHtml config.frontmatterParser config.toJsPort config.head config.parser config.content config.init
|
||||
, view = view config.content config.parser config.view
|
||||
, update = update config.update
|
||||
, subscriptions =
|
||||
|
@ -44,7 +44,6 @@ main =
|
||||
, markdownToHtml = markdownToHtml
|
||||
, toJsPort = toJsPort
|
||||
, head = head
|
||||
, siteUrl = "https://elm-pages.com"
|
||||
}
|
||||
|
||||
|
||||
@ -156,8 +155,8 @@ header =
|
||||
<https://html.spec.whatwg.org/multipage/semantics.html#standard-metadata-names>
|
||||
<https://ogp.me/>
|
||||
-}
|
||||
head : String -> Metadata.Metadata msg -> List Head.Tag
|
||||
head canonicalUrl metadata =
|
||||
head : Metadata.Metadata msg -> List Head.Tag
|
||||
head metadata =
|
||||
let
|
||||
themeColor =
|
||||
"#ffffff"
|
||||
@ -165,14 +164,18 @@ head canonicalUrl metadata =
|
||||
[ Head.metaName "theme-color" themeColor
|
||||
, Head.canonicalLink canonicalUrl
|
||||
]
|
||||
++ pageTags canonicalUrl metadata
|
||||
++ pageTags metadata
|
||||
|
||||
|
||||
canonicalUrl =
|
||||
"https://elm-pages.com"
|
||||
|
||||
|
||||
siteTagline =
|
||||
"A statically typed site generator - elm-pages"
|
||||
|
||||
|
||||
pageTags canonicalUrl metadata =
|
||||
pageTags metadata =
|
||||
case metadata of
|
||||
Metadata.Page record ->
|
||||
OpenGraph.website
|
||||
|
@ -42,10 +42,13 @@ main =
|
||||
, markdownToHtml = markdownToHtml
|
||||
, toJsPort = toJsPort
|
||||
, head = head
|
||||
, siteUrl = "https://incrementalelm.com"
|
||||
}
|
||||
|
||||
|
||||
siteUrl =
|
||||
"https://incrementalelm.com"
|
||||
|
||||
|
||||
markdownToHtml : String -> Element msg
|
||||
markdownToHtml body =
|
||||
Markdown.toHtmlWith
|
||||
@ -140,8 +143,8 @@ header =
|
||||
<https://html.spec.whatwg.org/multipage/semantics.html#standard-metadata-names>
|
||||
<https://ogp.me/>
|
||||
-}
|
||||
head : String -> Metadata.Metadata msg -> List Head.Tag
|
||||
head canonicalUrl metadata =
|
||||
head : Metadata.Metadata msg -> List Head.Tag
|
||||
head metadata =
|
||||
let
|
||||
siteName =
|
||||
"Incremental Elm Consulting"
|
||||
@ -151,8 +154,8 @@ head canonicalUrl metadata =
|
||||
in
|
||||
[ Head.metaName "theme-color" themeColor
|
||||
, Head.metaProperty "og:site_name" siteName
|
||||
, Head.metaProperty "og:url" canonicalUrl
|
||||
, Head.canonicalLink canonicalUrl
|
||||
, Head.metaProperty "og:url" siteUrl
|
||||
, Head.canonicalLink siteUrl
|
||||
]
|
||||
++ pageTags metadata
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user