forked from Geta/SEO.Sitemaps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSitemapUrlRoutingInit.cs
36 lines (30 loc) · 1.09 KB
/
SitemapUrlRoutingInit.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.Web.Mvc;
using System.Web.Routing;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using InitializationModule = EPiServer.Web.InitializationModule;
namespace Geta.SEO.Sitemaps
{
[InitializableModule]
[ModuleDependency(typeof (InitializationModule))]
public class SitemapUrlRoutingInit : IInitializableModule
{
private static bool _initialized;
public void Initialize(InitializationEngine context)
{
if (_initialized || context.HostType != HostType.WebApplication)
{
return;
}
RouteTable.Routes.MapRoute("Sitemap without path", "sitemap.xml", new { controller = "GetaSitemap", action = "Index" });
RouteTable.Routes.MapRoute("Sitemap with path", "{path}/sitemap.xml", new { controller = "GetaSitemap", action = "Index" });
_initialized = true;
}
public void Uninitialize(InitializationEngine context)
{
}
public void Preload(string[] parameters)
{
}
}
}