C# Class Decision.Common.Sitemap.SitemapGenerator

Generates sitemap XML.
Show file Open project: rabbal/Decision

Protected Methods

Method Description
GetSitemapDocuments ( IReadOnlyCollection sitemapNodes ) : List

Gets the collection of XML sitemap documents for the current site. If there are less than 25,000 sitemap nodes, only one sitemap document will exist in the collection, otherwise a sitemap index document will be the first entry in the collection and all other entries will be sitemap XML documents.

GetSitemapUrl ( int index ) : string

Gets the URL to the sitemap with the specified index.

LogWarning ( Exception exception ) : void

Logs warnings when a sitemap exceeds the maximum size of 10MB or if the sitemap index file exceeds the maximum number of allowed sitemaps. No exceptions are thrown in this case as the sitemap file is still generated correctly and search engines may still read it.

Private Methods

Method Description
CheckDocumentSize ( string sitemapXml ) : void

Checks the size of the XML sitemap document. If it is over 10MB, logs an error.

CheckSitemapCount ( int sitemapCount ) : void

Checks the count of the number of sitemaps. If it is over 50,000, logs an error.

GetSitemapDocument ( IEnumerable sitemapNodes ) : string

Gets the sitemap XML document for the specified set of nodes.

GetSitemapIndexDocument ( IEnumerable sitemaps ) : string

Gets the sitemap index XML document, containing links to all the sitemap XML documents.

Method Details

GetSitemapDocuments() protected method

Gets the collection of XML sitemap documents for the current site. If there are less than 25,000 sitemap nodes, only one sitemap document will exist in the collection, otherwise a sitemap index document will be the first entry in the collection and all other entries will be sitemap XML documents.
protected GetSitemapDocuments ( IReadOnlyCollection sitemapNodes ) : List
sitemapNodes IReadOnlyCollection The sitemap nodes for the current site.
return List

GetSitemapUrl() protected abstract method

Gets the URL to the sitemap with the specified index.
protected abstract GetSitemapUrl ( int index ) : string
index int The index.
return string

LogWarning() protected method

Logs warnings when a sitemap exceeds the maximum size of 10MB or if the sitemap index file exceeds the maximum number of allowed sitemaps. No exceptions are thrown in this case as the sitemap file is still generated correctly and search engines may still read it.
protected LogWarning ( Exception exception ) : void
exception System.Exception The exception to log.
return void