I'm trying to validate my Drupal 7 website on http://validator.w3.org but I can't keep getting the following error:

Attribute datatype not allowed on element meta at this point.

This is because <meta about="/frontpage" property="sioc:num_replies" content="0" datatype="xsd:integer" /> automatically gets the 'datatype=xsd:integer' attribute. I want to remove the datatype attribute altogether.


Apparently the meta tag isn't the problem. The problem is the validation service and how you use it. After some digging I found this article. The author suggest using a different validation type namely: http://validator.w3.org/nu/ with the following preset set in the additional options: "HTML5 + SVG 1.1 + MathML 2.0 + RDFa 1.1 + Microdata". This will validate said meta tags without any errors.

| improve this answer | |
  • The presets have changed; use "HTML5 + SVG 1.1 + MathML 3.0 + RDFa 1.1 + Microdata" – mrP May 22 '13 at 2:04

I don't know what effect this will have on the validity of that particular tag, but you can remove the property by implementing hook_html_head_alter() (either in your theme or a custom module file):

function MYTHEME_html_head_alter(&$head_elements) {
  if (isset($head_elements['rdf_node_comment_count'])) {
| improve this answer | |

Use this function to alter meta tags...

// hook_html_head_alter().
function YOUR_THEME_html_head_alter(&$head_elements) {
  dsm($head_elements); // if you have Devel installed
  var_dump($head_elements); // else use standard PHP dump
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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