Serves generated sitemaps and the built-in XSL stylesheets.
plug SiteMaps.Plug,
sitemaps: &MyAppWeb.Sitemaps.for_conn/1,
aliases: %{"/sitemap.xml" => "/sitemaps/sitemap.xml.gz"}Works in an endpoint, a pipeline or behind a router forward. Requests that are not sitemap files
of the resolved module pass through untouched, so the plug can sit in front of the rest of the app.
Options
:sitemaps-{module, context}, or a function receiving the conn and returning{module, context}ornil(pass through). Use a remote capture (&Mod.fun/1) when the plug is initialized at compile time. Required.:aliases- map of request path to the path to serve, e.g.%{"/sitemap.xml" => "/sitemap.xml.gz"}. An.xmlpath aliased to an.xml.gzfile is served uncompressed.:x_robots_tag-x-robots-tagheader (default"noindex, follow",nilto omit):cache_control-cache-controlheader. For sitemaps it defaults to the configuredcache_control, and the header is left out when both arenil. Stylesheets use this option when given, otherwise"public, max-age=3600".:stylesheet_paths-{urlset_path, index_path}serving the built-in stylesheets (default{"/_sitemap-stylesheet.xsl", "/_sitemap-index-stylesheet.xsl"},nilto disable). Pointxsl_stylesheet_url/xsl_index_stylesheet_urlat them.
The request path must be inside the directory of the configured sitemap URL; the file key is the
percent-decoded path relative to it. Keys failing SiteMaps.Adapter.validate_key/1 are rejected.
Only .xml and .xml.gz files are served. A .xml request for a missing file falls back to its
.xml.gz version, decompressed, when the sitemaps are gzipped.
Requests with an if-modified-since header at or after the file last_modified (compared in whole
seconds) get a 304 Not Modified. HEAD requests get the GET headers without decompressing the
file; content-length is omitted when the file would be decompressed.