Branding SharePoint 2013 Tricks – 3 – HTML5 DOCTYPE

Here is a simple one that can be frustrating when overlooked, yet the problem makes sense and is very easy to fix.

More than once a HTML file has been handed off to me “ready” for SharePoint 2013’s new Design Manager, i.e. we want to concert the HTML5 file to a HTML Master Page in SharePoint 2013’s new Design Manager. Past experience has taught me to quickly validate the HTML file, conforming to valid HTML5 (and is also XML compliant), no problems (so say many HTML5 and XML Validators).

Anyhow, I attempt to convert the HTML file to a HTML Master Page and I get the dreaded “Errors and Warnings” message. After clicking on the file in Design Manager I receive an error:

1
2
3
4
5
6
7
SharePoint requires HTML files to be XML-compliant. Your file isn't XML-compliant, likely because of tag properties without quotes, missing closing tags, or invalid properties in tags.

'
doctype' is an unexpected token. The expected token is 'DOCTYPE'. Line 1, position 3.

Occurred at: 11/1/2012 9:27:26 AM

Run the file through an XML validator, fix any issues using your HTML editor, save the file, and refresh this preview.

The message itself tells it all, but it is frustrating none the less. The “doctype” for HTML5 must include DOCTYPE in all capitals, “DOCTYPE”, which is the HTML5 standard, yet many web developers get lazy and it is easy for us to overlook. Even though most browsers and validators appear to accept non-all-caps “DOCTYPE”, SharePoint 2013 will keep us true.

Thus be diligent, make sure your DOCTYPE for HTML5 is exactly:

1
<!DOCTYPE html>

See of all of my SharePoint 2013 Branding Tricks and Discoveries.

Comments

  1. Thanks Eric. You the best. This thing bug me all night and I had NO idea it was something this minimal. Thumbs up man.

Speak Your Mind

*