File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
OnTopic.AspNetCore.Mvc/Controllers Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -90,8 +90,9 @@ public SitemapController(ITopicRepository topicRepository) {
9090 /// <summary>
9191 /// Provides the Sitemap.org sitemap for the site.
9292 /// </summary>
93+ /// <param name="indent">Optionally enables indentation of XML elements in output for human readability.</param>
9394 /// <returns>The site's homepage view.</returns>
94- public virtual ActionResult Index ( ) {
95+ public virtual ActionResult Index ( bool indent = false ) {
9596
9697 /*------------------------------------------------------------------------------------------------------------------------
9798 | Ensure topics are loaded
@@ -109,11 +110,12 @@ public virtual ActionResult Index() {
109110 \-----------------------------------------------------------------------------------------------------------------------*/
110111 var declaration = new XDeclaration ( "1.0" , "utf-8" , "no" ) ;
111112 var sitemap = GenerateSitemap ( rootTopic ) ;
113+ var settings = indent ? SaveOptions . None : SaveOptions . DisableFormatting ;
112114
113115 /*------------------------------------------------------------------------------------------------------------------------
114116 | Return the homepage view
115117 \-----------------------------------------------------------------------------------------------------------------------*/
116- return Content ( declaration . ToString ( ) + sitemap . ToString ( ) , "text/xml" ) ;
118+ return Content ( declaration . ToString ( ) + sitemap . ToString ( settings ) , "text/xml" ) ;
117119
118120 }
119121
You can’t perform that action at this time.
0 commit comments