elm-pages-v3-beta/examples/pokedex/app/Site.elm

47 lines
967 B
Elm
Raw Normal View History

2022-02-10 20:55:20 +03:00
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
2021-12-15 20:26:23 +03:00
, head = head
}
2022-02-10 20:55:20 +03:00
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 })