I tested two of my sites in W3C validator. One site passed the test and other site gave me lot of errors. Site2 was having the doctype -//W3C//DTD HTML+RDFa 1.1//EN instead of HTML5. But site1 was having HTML5.

How to change the doctype to HTML5 for Site2?


3 Answers 3


This would completely depend on the theme you are using on the Drupal site, as the markup of the site is handled on the theme layer.
If you are using an HTML5 theme, then the it will show the appropriate DOCTYPE i.e. <!DOCTYPE html>. In short, your theme should support HTML5 in order to get the DOCTYPE.

To answer your question, you'll need to either make your theme compatible to HTML5, or use any other HTML5 theme.
There is a very good article for Converting Your Drupal 7 Theme Into HTML5 which could give you a good start.


The HTML+RDFa 1.1 Doctype (which will be valid for HTML4 & 5) is still under development:

As such The W3 validator doesn't recognise it, even though your document might well validate against the standard itself.

So to answer your question, yes, Drupal (or what's more likely, the theme that you're using) is conforming to W3C standards, it's just that the spec hasn't been ratified yet.

You might see advice out there telling you not to use that DOCTYPE, that <!DOCTYPE html> should be used instead. That advice is incorrect, per the specification


I recently had to validate a Drupal website and was happy to find out that the W3C has a "Nu", experimental validator, which can be preset to take RDFa 1.1 into account (among other things).

Using this validator instead of the default one made all of the RDFa-related validation errors disappear, but you have to manually set up the "Preset" parameter to HTML5 + SVG 1.1 + MathML 3.0 + RDFa 1.1 + Microdata.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.