DAVID  BYRDEN

LEGAL SEO EXAMPLE graphics
 
 

Valid HTML and OGP (Open Graph Protocol) metadata | How to combine them

Document types for OGP metadata

The Open Graph Protocol requires you to add specific data to your web page. The data is put in <meta> tags in the page's head, with 'property' and 'content' attributes. Unfortunately, HTML does not allow these attribute names. If you check your page's format, you will find that it is now invalid.

These attribute names are part of a standard called "RDFa". It was meant to be incorporated into future versions of XHTML. These versions are not yet available.

Fortunately, RDFa was also added to the existing version of XHTML, resulting in a new type of document called XHTML+RDFa. You can easily change your document type from XHTML to this new type, making your page valid again.

The document type declaration for XHTML+RDFa is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">

and the <html> element should get this attribute:

version="XHTML+RDFa 1.1"

Adding OGP metadata to your page

 
 
valid XML
valid CSS
Copyright © David Byrden 1997-2011