An open API service indexing awesome lists of open source software.

https://github.com/agility/sitemapcontroller-netframework

Sample code demonstrating how you can generate a sitemap.xml file based on your Agility pages.
https://github.com/agility/sitemapcontroller-netframework

Last synced: about 1 year ago
JSON representation

Sample code demonstrating how you can generate a sitemap.xml file based on your Agility pages.

Awesome Lists containing this project

README

          

# SitemapController-NETFramework
Sample code demonstrating how you can generate a sitemap.xml file based on your Agility CMS pages. This is for use with `Agility.Web` for a .NET Framework MVC website.

## Usage
1. In your ASP.NET MVC project, create a Controller Action Result in your website and name it `SitemapController.cs'.
2. Copy and paste the contents of [SitemapController.cs](https://github.com/agility/SitemapController-NETFramework/blob/master/SitemapController.cs) in your controller you just created.
3. In your `~/App_Start/RouteCongig.cs` file, add in the following route mapping:
```
routes.MapRoute("Sitemap", "sitemap.xml", new { controller = "Sitemap", action = "XmlSitemap" });
```

## Test
Run your site locally and navigate to `/sitemap.xml` and you should have XML output that looks something like:
```


http://localhost/
1.0
daily


http://localhost/customer-gallery
2016-01-14T17:52:25Z
daily


http://localhost/products
2019-01-18T14:04:23Z
daily


http://localhost/contact-us
2019-08-19T20:32:54Z
daily

```