Example #1
0
        private void WriteItem(Item item)
        {
            if (SitemapWorker.ShouldWrite(item))
            {
                this._Writer.WriteStartElement("url");

                string text = LinkManager.GetItemUrl(item, this._UrlOptions);

                if (text.IndexOf("http://") <= -1 || text.IndexOf("https://") <= -1)
                {
                    text = text.Replace("://", "http://");
                }
                this._Writer.WriteElementString("loc", HttpUtility.UrlPathEncode(text));
                this._Writer.WriteElementString("lastmod", SitemapWorker.ToWtcDate(item.Statistics.Updated));
                if (!string.IsNullOrEmpty(SitemapWorker.CalculateChangeFreq(item)))
                {
                    this._Writer.WriteElementString("changefreq", SitemapWorker.CalculateChangeFreq(item));
                }
                this._Writer.WriteElementString("priority", SitemapWorker.CalculatePriority(item));
                this._Writer.WriteEndElement();
            }
        }
Example #2
0
 public SitemapWorker(SitemapGenerator generator, XmlTextWriter writer, string site, bool addAspxExtension)
 {
     this._Generator  = generator;
     this._Writer     = writer;
     this._UrlOptions = SitemapWorker.GetUrlOptions(site, addAspxExtension);
 }