WordPress.org

Ready to get started?Download WordPress

Forums

Facebook
[resolved] Open Graph Tags Conflict (4 posts)

  1. jgbeldock
    Member
    Posted 2 years ago #

    It appears that the Facebook plugin automatically generates OG tags. Unfortunately, there seems to be a conflict between what those contain and what the developers.facebook.com app tells me to use. Is there a way to turn off the automatic generation by the Facebook plugin so I can control the content (i.e., write my own tags as part of my theme)?

    Here's what the Facebook plugin automatically generates:

    <meta property="http://ogp.me/ns#locale" content="en_US" />
    <meta property="http://ogp.me/ns#site_name" content="[blah]" />
    <meta property="http://ogp.me/ns#type" content="website" />  <strong>note, *NOT* what FB recommends!</strong>
    <meta property="http://ogp.me/ns#title" content="[blah]" />
    <meta property="http://ogp.me/ns#description" content="[blah]" />
    <meta property="http://ogp.me/ns/fb#app_id" content="[somenumber]" />

    And here's what the developers.facebook.com website tells me to use, which makes sense, because I am creating an APP, as the instructions for their plugin specifically tells me to do:

    <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/article#">
      <meta property="fb:app_id"      content="[somenumber" />
      <meta property="og:type"        content="article" /> <strong>This makes more sense </strong>
      <meta property="og:url"         content="Put your own URL to the object here" />
      <meta property="og:title"       content="Your Open Graph object title" />
      <meta property="og:image"       content="http://ogp.me/logo.png" />
      <meta property="og:description" content="Your Open Graph object description" />

    Anyone know how to turn off the automatic generation so I can implement what they tell me I should?

    Thanks!
    -James

    http://wordpress.org/extend/plugins/facebook/

  2. Niall Kennedy
    Member
    Plugin Author

    Posted 2 years ago #

    Facebook recommends mapping a prefix to a URI at a parent element (head) and simply referencing that prefix later in the document. Declaring an RDFa CURIE in this way is cleaner: og: http://ogp.me/ns# + og:url instead of http://ogp.me/ns#url.

    Not all themes may provide access to parents of the <meta> element: <head> or <html>. Given that unknown it's better to declare the full property than reference an undeclared prefix.

    The Open Graph protocol defines "website" as its default type. The "article" type is another option in the global namespace. You could also declare your own under your application. A type of "website" could make sense for a site homepage; a type of "article" could make sense for an individual post with extra article properties declared for indexing such as publish date and author.

    You can always tap into the fb_meta_tags filter and override the defaults set by the Facebook plugin for a given query type.

  3. Steve
    Member
    Posted 2 years ago #

    Thanks for clarifying that Niall. It seems odd that this cleaner method is not documented by Facebook which is probably why I was wondering the same thing.

  4. jgbeldock
    Member
    Posted 2 years ago #

    Niall, thank you. That makes a lot of sense. I wasn't aware of the existence of the fb_meta_tags filter, but now I am. :-)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic