Sitemapper v0.4.0 Sitemapper View Source
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.
Link to this section 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
.
Receives a Stream
of {filename, body}
tuples, takes the last
one (the index file), and pings Google and Bing with its URL.
Link to this section Functions
generate(enum, opts)
View Sourcegenerate(stream :: Enumerable.t(), opts :: keyword()) :: Stream.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.
Accepts the following Keyword
options in opts
:
sitemap_url
- The base URL where the generated sitemap files will live. e.g.http://example.org
, if your sitemap lives athttp://example.org/sitemap.xml
(required)gzip
- Sets whether the files are gzipped (default:true
)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. (default:nil
)index_lastmod
- An optional Date/DateTime/NaiveDateTime for the lastmod element in the index. (default:Date.utc_today()
)
persist(enum, opts)
View Sourcepersist(Enumerable.t(), keyword()) :: Stream.t()
Receives a Stream
of {filename, body}
tuples, and persists
those to the Sitemapper.Store
.
Will raise if persistence fails.
Accepts the following Keyword
options in opts
:
store
- The module of the desiredSitemapper.Store
, such asSitemapper.S3Store
. (required)store_config
- AKeyword
list with options for theSitemapper.Store
. (optional, but usually required)
Receives a Stream
of {filename, body}
tuples, takes the last
one (the index file), and pings Google and Bing with its URL.