How to fix: Bad value twitter:card for attribute name on element meta: keyword twitter:card is not registered.

Most Likely Cause and Fix

Your HTML5 markup contains a Twitter Card meta element that uses a currently-invalid value for the name attribute:

<meta name="twitter:card" content="foo" >

Use the HTML5 meta property attribute instead:

<meta property="twitter:card" content="foo" >

What This Error Means

Some element attributes can take pretty much any value, others can take only values of a certain type and others still can only take a value from a pre-defined set.

This error relates to the following usage in your markup:

<meta name="twitter:card">

The error is stating that, in this context, the attribute name on element meta is not allowed to take the value twitter:card

The validator is giving the reason: keyword twitter:card is not registered.

How To Fix It

For Twitter Card meta elements in HTML5 documents

The Twitter Card documentation states that you should add meta elements to your markup in the form:

<meta name="twitter:card" content="foo" >

Under HTML5 the name attribute must be one of a pre-defined set. The above markup will not be valid until the relevant value (twitter:card) has been registered.

Swap the name attribute for an otherwise-identical property attribute to create valid syntax that is recognised by Twitter.

<meta property="twitter:card" content="summary">
<meta property="twitter:site" content="simplytestable">
<meta property="twitter:title" content="Title Here">
<meta property="twitter:description" content="Description Here">
<meta property="twitter:creator" content="simplytestable">
<meta property="twitter:image:src" content="">        
<meta property="twitter:domain" content="">

Discuss, Comment and Improve

Did this help you? Can this page be improved? Let us know!

comments powered by Disqus