How To Create A Site Map Using DNN And C#

- 1 answer

My website is This site is built from DotNetNuke. It has default sitemap is This sitemap only shows the page URL without any parameters. I want my site map to show all product in my database. Such as

Please give my suggestion. Should I create a custom sitemap for my requirement?



You can do this with the Sitemap provider in DNN. My open source DNNSimpleArticle module has an example of this:

public override List<SitemapUrl> GetUrls(int portalId, PortalSettings ps, string version)
    var listOfUrls = new List<SitemapUrl>();

    foreach (Article ai in ArticleController.GetAllArticles(portalId))

        var pageUrl = new SitemapUrl
            Url = ArticleController.GetArticleLink(ai.TabID, ai.ArticleId),
            Priority = (float)0.5,
            LastModified = ai.LastModifiedOnDate,
            ChangeFrequency = SitemapChangeFrequency.Daily

    return listOfUrls;

Then you will need to register that, you can do it with the .DNN file

<component type="Config">
          <node path="/configuration/dotnetnuke/sitemap/providers" action="update" key="name" collision="overwrite">
             <add name="DNNSimpleArticleSiteMapProvider" type="Christoc.Modules.dnnsimplearticle.Providers.Sitemap.Sitemap, DNNSimpleArticle" providerPath="~\DesktopModules\dnnsimplearticle\Providers\Sitemap\" />
        <nodes />