/AspNetCore.SEOHelper

Helps to create routing robots.txt and sitemap.xml for asp.net core project.

Primary LanguageC#

AspNetCore.SEOHelper

Nuget package : click

Helps to create routing robots.txt and sitemap.xml for asp.net core project.

Routing for robots.txt

app.UseRobotsTxt(env.ContentRootPath);

Routing for sitemap.xml

  app.UseXMLSitemap(env.ContentRootPath);

Creating SEO friendly URL

    string queryString = "Asp.Net MVC Tutorial Part-1";
    var seoQueryString = queryString.ToSEOQueryString();
    var url = $"http://www.example.com/{seoQueryString}";

How to create sitemap.xml click for details

          var list = new List<SitemapNode>();
          list.Add(new SitemapNode { LastModified = DateTime.UtcNow, Priority = 0.8, Url = "https://codingwithesty.com/serilog-mongodb-in-asp-net-core", Frequency = SitemapFrequency.Daily });
          list.Add(new SitemapNode { LastModified = DateTime.UtcNow, Priority = 0.8, Url = "https://codingwithesty.com/logging-in-asp-net-core", Frequency = SitemapFrequency.Yearly });

          new SitemapDocument().CreateSitemapXML(list, _env.ContentRootPath);
      

Loading Existing sitemap.xml

List items = new SitemapDocument().LoadFromFile(_env.ContentRootPath);