2022-02-10 20:55:20 +03:00
|
|
|
module Site exposing (canonicalUrl, config)
|
2021-06-01 20:36:52 +03:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
2021-06-01 20:36:52 +03:00
|
|
|
|
|
|
|
|
2022-02-10 20:55:20 +03:00
|
|
|
canonicalUrl : String
|
|
|
|
canonicalUrl =
|
|
|
|
"https://elm-pages.com"
|
|
|
|
|
|
|
|
|
2021-06-01 20:36:52 +03:00
|
|
|
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 })
|