I would like to generate a complex sitemap with Umbraco CMS as it needs to accommodate all the possible links that can be found on the site.
So I would like to have the following structure:
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>http://www.example.com/sitemap1.xml.gz</loc>
<lastmod>2004-10-01T18:23:17+00:00</lastmod>
</sitemap>
<sitemap>
<loc>http://www.example.com/sitemap2.xml.gz</loc>
<lastmod>2005-01-01</lastmod>
</sitemap>
....
</sitemapindex>
I cannot find documentation for producing a sitemap like the above from the Umbraco. As I am new to Umbraco CMS, I'd like to ask if I need to create multiple Sitemap pages for example if I have 500.000 pages that I'd like to add, should I create 10 Sitemap views (IPublishedContent) - each one containing up to 50.000 elements- and add them to the Sitemap parent view in the CMS? And if yes, is there a chance I can do this dynamically?
You can create
SitemapController
where you transform all Umbraco nodes to xml. You can get all nodes using thatUmbraco.ContentAtRoot().Descendants().Where(<YOUR_CONDITIONAL>).
To convert nodes to XML use XDocument.