Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Stefano 61 posts 311 karma points c-trib
    Mar 05, 2017 @ 10:14

    My sitemap xml generator

    I wrote a generator for XML sitemap for SEO purposes and deployed to a number of websites. It relies on this package and a couple of fields (sitemapXmlPriority and sitemapXmlChangeFrequency) to fill in all the data. I recommend having a root document type for your public-facing pages with those in so that they get inherited by the other pages.


    Response.Write(@"<?xml version=""1.0"" encoding=""UTF-8"" ?>"); seems dirty, but in one instance a website was adding an empty line and couldn't find the reason for it, this makes sure it doesn't happen and the XML validates.

    If you don't have C# 6 installed you can change string.Format("{0:s}+00:00", node.UpdateDate) to node.UpdateDate.ToString("s") + "+00:00". There is probably a more proper way to do it still.

Please Sign in or register to post replies

Write your reply to: