mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-24 20:31:42 +03:00
47 lines
967 B
Elm
47 lines
967 B
Elm
module Site exposing (canonicalUrl, config)
|
|
|
|
import DataSource exposing (DataSource)
|
|
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 : DataSource (List Head.Tag)
|
|
head =
|
|
[ Head.sitemapLink "/sitemap.xml"
|
|
]
|
|
|> DataSource.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 })
|