uhaciogullari / SimpleMvcSitemap

A minimalist library for creating sitemap files inside ASP.NET MVC and ASP.NET Core MVC applications
MIT License
128 stars 39 forks source link

Response content type changes with Produce attribute #45

Closed irensaltali closed 3 years ago

irensaltali commented 3 years ago

XmlResult.cs always returning "Content-Type" as "text/xml". But Google requires sitemaps as "application/xml". Besides, there is a Produce attribute on .NET MVC but XmlResult.cs overwrites it. So I made a change to read Produce attribute and change "Content-Type" header based on that.

uhaciogullari commented 3 years ago

Hi @irensaltali

Do you have any links or screenshots for content type requirement? If it's required we should simply set it so without Produces attribute.

irensaltali commented 3 years ago

I couldn't again on Google but https://www.xml-sitemaps.com/validate-xml-sitemap.html gives error on "text/xml". I think Google is resolving it either way. I wrote it wrong.

I think Produce attribute is still better way of doing that.

image

uhaciogullari commented 3 years ago

Hi İren

I pushed the content type changes to master already. There is a new NuGet package and it should be published soon. Thank a lot for the PR. Have a great day.