diff --git a/src/Dfe.ContentSupport.Web/Controllers/SitemapController.cs b/src/Dfe.ContentSupport.Web/Controllers/SitemapController.cs index fe6530d..d57b001 100644 --- a/src/Dfe.ContentSupport.Web/Controllers/SitemapController.cs +++ b/src/Dfe.ContentSupport.Web/Controllers/SitemapController.cs @@ -1,11 +1,35 @@ -using Dfe.ContentSupport.Web.Services; +using Dfe.ContentSupport.Web.Models.Mapped; +using Dfe.ContentSupport.Web.Services; +using Dfe.ContentSupport.Web.ViewModels; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace Dfe.ContentSupport.Web.Controllers; +[Route("/sitemap")] +[AllowAnonymous] public class SitemapController(IContentService contentfulService) : Controller { + [HttpGet] + [Route("/")] public async Task Index() + { + var defaultModel = new CsPage + { + Heading = new Models.Heading + { + Title = "Department for Education", + Subtitle = "Content and Support" + } + }; + + + return View(defaultModel); + } + + [HttpGet] + [Route("/sitemap.xml")] + public async Task Sitemap() { var baseUrl = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host}/"; var sitemap = await contentfulService.GenerateSitemap(baseUrl); diff --git a/src/Dfe.ContentSupport.Web/Program.cs b/src/Dfe.ContentSupport.Web/Program.cs index f2d3870..62b2e40 100644 --- a/src/Dfe.ContentSupport.Web/Program.cs +++ b/src/Dfe.ContentSupport.Web/Program.cs @@ -41,7 +41,7 @@ public static void Main(string[] args) app.UseCookiePolicy(); app.MapControllerRoute( - "sitemap", + "Default", "sitemap.xml", new { controller = "Sitemap", action = "Index" } ); @@ -52,9 +52,6 @@ public static void Main(string[] args) pattern: "{controller=Cache}/{action=Clear}" ); - app.MapControllerRoute( - name: "home", - pattern: "{controller=Home}/{action=Home}"); app.MapControllerRoute( name: "slug", diff --git a/src/Dfe.ContentSupport.Web/Views/Sitemap/Index.cshtml b/src/Dfe.ContentSupport.Web/Views/Sitemap/Index.cshtml new file mode 100644 index 0000000..33c6f37 --- /dev/null +++ b/src/Dfe.ContentSupport.Web/Views/Sitemap/Index.cshtml @@ -0,0 +1,2 @@ +@model CsPage +