Today should have been part two on the series on Document Types. But things doesn't always turn out the way you planned and this day was one of them. So it's just one of the quick tricks I had planned to save for later.
Many people are attracted to umbraco because it makes it possible to comply with standards, making it possible to create accessible webpages with valid (x)html. When you've spend time struggling with your markup it's always a big satisfaction to get that big green "VALID" message from W3C. However, if you use .NET controls it's harder that it ought to be.
Now, Microsoft have done massive progress in making their controls produce better markup and with ASP.NET 2.0 we got the possibility to tell it to run our website in XHTML Strict mode by adding an element in the web.config (default in the umbraco distribution). However, I guess that Microsoft wasn't really aware of the W3C Validator that most of us are using as the .NET Framework recognizes the validator as a downgraded browser and starts spitting out invalid html - doh!
But fear not - the fix is easy and all you need to do is add the following to the /config/browsercaps.config in your umbraco installation:
<case match="W3C_Validator*"> tagWriter = System.Web.UI.HtmlTextWriter W3CDomVersion = 1.0 </case>
Now go make your site valid! I'll be back tomorrow with another trick and then continue the Document Type and Template tutorial Thursday and Friday.