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

53 lines
1.0 KiB
Elm
Raw Normal View History

2022-02-10 20:55:20 +03:00
module Site exposing (canonicalUrl, config)
import DataSource
import Head
import Pages.Manifest as Manifest
import Route exposing (Route)
import SiteConfig exposing (SiteConfig)
import Sitemap
type alias Data =
()
config : SiteConfig Data
config =
2021-12-15 20:26:23 +03:00
{ data = data
2022-02-10 20:55:20 +03:00
, 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"
data : DataSource.DataSource Data
data =
DataSource.succeed ()
head : Data -> List Head.Tag
head static =
[ Head.sitemapLink "/sitemap.xml"
]
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 })