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) {
90
90
/// <summary>
91
91
/// Provides the Sitemap.org sitemap for the site.
92
92
/// </summary>
93
+ /// <param name="indent">Optionally enables indentation of XML elements in output for human readability.</param>
93
94
/// <returns>The site's homepage view.</returns>
94
- public virtual ActionResult Index ( ) {
95
+ public virtual ActionResult Index ( bool indent = false ) {
95
96
96
97
/*------------------------------------------------------------------------------------------------------------------------
97
98
| Ensure topics are loaded
@@ -109,11 +110,12 @@ public virtual ActionResult Index() {
109
110
\-----------------------------------------------------------------------------------------------------------------------*/
110
111
var declaration = new XDeclaration ( "1.0" , "utf-8" , "no" ) ;
111
112
var sitemap = GenerateSitemap ( rootTopic ) ;
113
+ var settings = indent ? SaveOptions . None : SaveOptions . DisableFormatting ;
112
114
113
115
/*------------------------------------------------------------------------------------------------------------------------
114
116
| Return the homepage view
115
117
\-----------------------------------------------------------------------------------------------------------------------*/
116
- return Content ( declaration . ToString ( ) + sitemap . ToString ( ) , "text/xml" ) ;
118
+ return Content ( declaration . ToString ( ) + sitemap . ToString ( settings ) , "text/xml" ) ;
117
119
118
120
}
119
121
You can’t perform that action at this time.
0 commit comments