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.
- Host: GitHub
- URL: https://github.com/agility/sitemapcontroller-netframework
- Owner: agility
- Created: 2019-07-08T13:08:40.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-25T18:20:20.000Z (over 6 years ago)
- Last Synced: 2025-02-14T04:51:14.033Z (over 1 year ago)
- Language: C#
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
```