Hello,

I'm working on a module which will allow integration with Open Graph protocol. During implementation I found a problem with some code from the nodewords api:

function opengraph_nodewords_tags_info() {
  $tags = array(
    'opengraph_type' => array(
	'tag:context:allowed' => array(
        NODEWORDS_TYPE_NODE,
        NODEWORDS_TYPE_PAGE,
      ),
      'tag:function:prefix' => 'nodewords_opengraph_type',
      'tag:template' => array(
        'og:type' => NODEWORDS_META,
      ),
      'widget:label' => t('Open Graph - Type property tag'),
      'widget:permission' => 'edit Open Graph - Type property tag',
    ),
  );

  return $tags;
}

.....

function nodewords_opengraph_type_prepare(&$tags, $content, $options) {
  if (!empty($content['value'])) {
    $tags['opengraph_type:og:type'] = $content['value'];
  } else {
//testing stuff
  drupal_set_message("no luck");  
  }
}

If I change the following lines to something other than "og:type" to something like "og;type", it will come out fine. How can I escape the colon so that it print's out in the meta information? The following lines should work, but I believe parsing is not being done correctly. I'm hoping and expecting a simple fix.

$tags['opengraph_type:og:type'] = $content['value'];

  'tag:template' => array(
        'og:type' => NODEWORDS_META,
  ),
CommentFileSizeAuthor
#2 nodewords_opengraph.zip3.44 KBmgenereu
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

stevesmename’s picture

Category: support » feature
Status: Needs review » Closed (works as designed)

A couple things I see is that line 1101 in the nodewords.module strips out the colons in names and explodes them out.

$parts = explode(':', $name);

I also see that nodewords module strictly deals with name meta tags and not additional tags like 'property' which is what Open Graph requires. http://developers.facebook.com/docs/opengraph#extra-data

<meta property="fb:admins" content="USER_ID1,USER_ID2"/>

Unless there is not a road map allowing additional tags like 'property' be available within the nodewords module then it's best to move on integrating this module with another module instead.

mgenereu’s picture

Version: 6.x-1.9 » 6.x-1.11
Status: Closed (works as designed) » Active
FileSize
3.44 KB

I created an Open Graph Nodewords module as well. It's tossed together just to get the job done and would like to see made part of the Nodewords project so that it can continue to mature. I had to change two things in the main Nodewords module to make it work:

1. The explode thing mentioned above is just not compatible and I can't find any reason anywhere in the docs as to why it does it. Looks like an over complication of the API for namespaces or something but nothing else chokes on names with colons other than this one output location.

Replaced:

$parts = explode(':', $name);

With:

$parts[0] = $name;
$parts[1] = $name;

2. Increase the template constants by one because the case statement where these are used were returning true when NODEWORDS_META's value of 0 was compared to my provided templates that use "property" instead of "name". This is more of bug fix to nodewords.module to get its custom template support working.

define('NODEWORDS_META', 1);
define('NODEWORDS_HTTP_EQUIV', 2);
define('NODEWORDS_LINK_REL', 3);
define('NODEWORDS_LINK_REV', 4);

This is live in production and successfully working. Anybody who wants to help make this more than an attachment in an issue, please let me know what I can do to help!

Whackler’s picture

Nice, thanks!

I can see myself entering an opengraph image for each page on my site, but the title and url ?
Can tokens be used or something else to automate this ?

lolandese’s picture

toomanypets’s picture

Posted a custom module for adding Open Graph protocol meta tags here:
http://drupal.org/node/784904#comment-3582838

Dave Reid’s picture

Status: Active » Closed (duplicate)

Merging this issue into #803512: Support Open Graph Protocol meta tags since we don't need two issues for supporting Open Graph meta tags.

nitin_kumar’s picture

Status: Closed (duplicate) » Closed (works as designed)

Thanx for add attachment, works fine for me.

DamienMcKenna’s picture

Status: Closed (works as designed) » Closed (duplicate)