2022-02-10 20:55:20 +03:00
|
|
|
module Site exposing (canonicalUrl, config)
|
2021-06-01 20:36:52 +03:00
|
|
|
|
2022-02-17 03:54:52 +03:00
|
|
|
import DataSource exposing (DataSource)
|
2021-06-01 20:36:52 +03:00
|
|
|
import Head
|
|
|
|
import Route exposing (Route)
|
|
|
|
import SiteConfig exposing (SiteConfig)
|
|
|
|
import Sitemap
|
|
|
|
|
|
|
|
|
|
|
|
type alias Data =
|
|
|
|
()
|
|
|
|
|
|
|
|
|
2022-02-17 03:54:52 +03:00
|
|
|
config : SiteConfig
|
2021-06-01 20:36:52 +03:00
|
|
|
config =
|
2022-02-17 03:54:52 +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"
|
|
|
|
|
|
|
|
|
2022-02-17 03:54:52 +03:00
|
|
|
head : DataSource (List Head.Tag)
|
|
|
|
head =
|
2021-06-01 20:36:52 +03:00
|
|
|
[ Head.sitemapLink "/sitemap.xml"
|
|
|
|
]
|
2022-02-17 03:54:52 +03:00
|
|
|
|> DataSource.succeed
|
2021-06-01 20:36:52 +03:00
|
|
|
|
|
|
|
|
|
|
|
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 })
|