mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-27 22:01:48 +03:00
48 lines
1022 B
Elm
48 lines
1022 B
Elm
module Site exposing (canonicalUrl, config)
|
|
|
|
import BackendTask exposing (BackendTask)
|
|
import FatalError exposing (FatalError)
|
|
import Head
|
|
import Route exposing (Route)
|
|
import SiteConfig exposing (SiteConfig)
|
|
import Sitemap
|
|
|
|
|
|
type alias Data =
|
|
()
|
|
|
|
|
|
config : SiteConfig
|
|
config =
|
|
{ canonicalUrl = canonicalUrl
|
|
, head = head
|
|
}
|
|
|
|
|
|
canonicalUrl : String
|
|
canonicalUrl =
|
|
"https://elm-pages.com"
|
|
|
|
|
|
head : BackendTask FatalError (List Head.Tag)
|
|
head =
|
|
[ Head.sitemapLink "/sitemap.xml"
|
|
]
|
|
|> BackendTask.succeed
|
|
|
|
|
|
siteMap :
|
|
List (Maybe Route)
|
|
-> { path : List String, content : String }
|
|
siteMap allRoutes =
|
|
allRoutes
|
|
|> List.filterMap identity
|
|
|> List.map
|
|
(\route ->
|
|
{ path = Route.routeToPath route |> String.join "/"
|
|
, lastMod = Nothing
|
|
}
|
|
)
|
|
|> Sitemap.build { siteUrl = "https://elm-pages.com" }
|
|
|> (\sitemapXmlString -> { path = [ "sitemap.xml" ], content = sitemapXmlString })
|