View Source Sitemapper (Sitemapper v0.9.0)
Sitemapper is an Elixir library for generating XML Sitemaps.
It's designed to generate large sitemaps while maintaining a low memory profile. It can persist sitemaps to Amazon S3, disk or any other adapter you wish to write.
Summary
Functions
Receives a Stream
of Sitemapper.URL
and returns a Stream
of
{filename, body}
tuples, representing the individual sitemap XML
files, followed by an index XML file.
Receives a Stream
of {filename, body}
tuples, and persists
those to the Sitemapper.Store
.
Functions
@spec generate(stream :: Enumerable.t(), opts :: keyword()) :: Enumerable.t()
Receives a Stream
of Sitemapper.URL
and returns a Stream
of
{filename, body}
tuples, representing the individual sitemap XML
files, followed by an index XML file.
Configuration:
Accepts the following Keyword
options in opts
:
:sitemap_url
(required) - The base URL where the generated sitemap files will live. e.g.http://example.org
, if your sitemap lives athttp://example.org/sitemap.xml
:gzip
(default:true
) - Sets whether the files are gzipped:name
- An optional suffix for the sitemap filename. e.g. If you set tonews
, will producesitemap-news.xml.gz
andsitemap-news-00001.xml.gz
filenames.:index_lastmod
(default:Date.utc_today()
) - An optional Date/DateTime/NaiveDateTime for the lastmod element in the index.
@spec persist( Enumerable.t(), keyword() ) :: Enumerable.t()
Receives a Stream
of {filename, body}
tuples, and persists
those to the Sitemapper.Store
.
Will raise if persistence fails.
Configuration:
Accepts the following Keyword
options in opts
:
:store
(required) - The module of the desiredSitemapper.Store
, such asSitemapper.S3Store
orSitemapper.FileStore
.:store_config
(optional, but usually required) - AKeyword
list with options for theSitemapper.Store
.