Search code examples
facebook-opengraphmetaschema.orgmicrodatardfa

Using Schema.org itemprop on Facebook OG meta tags


Right now I'm using itemprop COMBINED with Facebook Open Graph <meta> tags like the following:

<html class="no-js" itemscope="itemscope" itemtype="http://schema.org/WebPage">
   // ...
  <meta property="og:type" content="website" /> 
  <meta itemprop="name" property="og:title" content="My Title" />
  <meta itemprop="image" property="og:image" content="http://example.com/socialimage.jpg" />
  <meta itemprop="url" property="og:url" content="http://example.com" />
  <meta itemprop="description" property="og:description" content="My description" />
  <meta property="og:site_name" content="My Site"/>

Is this acceptable/valid to do?


Solution

  • itemprop is defined by Microdata, property is defined by RDFa. So your question is: Can Microdata and RDFa be used on the same meta element?

    Yes, as I have explained in a similar (but not identical) question:

    When using Microdata on meta, the following attributes are not allowed: name, http-equiv, charset. When using RDFa on meta, these three attributes are optional. In both cases the content attribute is required.


    Note that you could stop using Microdata and use RDFa also for Schema.org:

    <html typeof="schema:WebPage">
      <!-- … -->
      <meta property="og:type" content="website" /> 
      <meta property="og:title schema:name" content="My Title" />
      <meta property="og:image schema:image" content="http://example.com/socialimage.jpg" />
      <meta property="og:url schema:url" content="http://example.com" />
      <meta property="og:description schema:description" content="My description" />
      <meta property="og:site_name" content="My Site"/>
    

    Also note that you should use link instead of meta when the value is a URL:

      <meta property="og:type" content="website" /> 
      <meta property="og:title schema:name" content="My Title" />
      <link property="og:image schema:image" href="http://example.com/socialimage.jpg" />
      <link property="og:url schema:url" href="http://example.com" />
      <meta property="og:description schema:description" content="My description" />
      <meta property="og:site_name" content="My Site"/>