Esempio n. 1
0
        public void SitemapIndex()
        {
            const int count = 10;
            var       items = new IndexElement[count];

            for (var i = 0; i < count; i++)
            {
                items[i] = new IndexElement
                {
                    Url      = "http://example.com/page" + (i + 1),
                    Modified = DateTime.Now.Add(TimeSpan.FromMinutes(i + 1))
                };
            }

            var xDoc = SitemapBuilder.BuildIndexMap(items);

            Assert.Equal(count, xDoc.Root.Descendants(SitemapConstants.NS + "sitemap").Count());

            xDoc.Save("sitemap_index.xml");
        }