SiteMaps.XML (site_maps v0.1.0)

Copy Markdown View Source

iodata rendering of urlsets and sitemap indexes.

Only set values are written, every text and attribute is escaped, and child elements follow the order of the sitemap, image, video and news XSDs.

Summary

Functions

Escapes the five XML entities and drops characters that are not allowed in XML 1.0 (control characters and invalid UTF-8).

One <sitemap> entry of an index.

Closing </sitemapindex>.

XML declaration, optional stylesheet instruction and the opening <sitemapindex>.

One <url> entry. default_changefreq and default_priority of config apply when the entry has no value of its own.

Closing </urlset>.

XML declaration, optional stylesheet instruction and the opening <urlset> with every namespace.

Functions

escape(value)

@spec escape(String.t()) :: iodata()

Escapes the five XML entities and drops characters that are not allowed in XML 1.0 (control characters and invalid UTF-8).

iex> SiteMaps.XML.escape("a&b <c> \"d\" 'e'") |> IO.iodata_to_binary()
"a&amp;b &lt;c&gt; &quot;d&quot; &apos;e&apos;"

index_entry(index_entry)

@spec index_entry(SiteMaps.IndexEntry.t()) :: iodata()

One <sitemap> entry of an index.

index_footer()

@spec index_footer() :: iodata()

Closing </sitemapindex>.

index_header(config)

@spec index_header(SiteMaps.Config.t()) :: iodata()

XML declaration, optional stylesheet instruction and the opening <sitemapindex>.

url(url, config)

@spec url(SiteMaps.URL.t(), SiteMaps.Config.t()) :: iodata()

One <url> entry. default_changefreq and default_priority of config apply when the entry has no value of its own.

urlset_footer()

@spec urlset_footer() :: iodata()

Closing </urlset>.

urlset_header(config)

@spec urlset_header(SiteMaps.Config.t()) :: iodata()

XML declaration, optional stylesheet instruction and the opening <urlset> with every namespace.