for more information visit the package's GitHub page
Package contains the following modules:
elm-sitemap
A simple interface for building a String of an XML sitemap from structured elm data, following the sitemap protocol.
Note: this package was built as utility for elm-pages
apps,
and it may be become more coupled to elm-pages
over time.
Here's an example from an elm-pages
app.
import Metadata exposing (Metadata(..)) -- this is the user's metadata custom type
import Pages
import Pages.PagePath as PagePath exposing (PagePath)
import Sitemap
build :
{ siteUrl : String
}
->
List
{ path : PagePath Pages.PathKey
, frontmatter : Metadata
, body : String
}
->
{ path : List String
, content : String
}
build config siteMetadata =
{ path = [ "sitemap.xml" ]
, content =
Sitemap.build config
(siteMetadata
|> List.map
(\page ->
{ path = PagePath.toString page.path
, lastMod = Nothing }
)
)
}