Open Graph Protocol is described here: http://developers.facebook.com/docs/opengraph
It is a Facebook initiative and used by at least Facebook (but not limited to them).
The following is an excerpt from that page:
---------
The Open Graph protocol defines five required properties:
* og:title - The title of your object as it should appear within the graph, e.g., "The Rock".
* og:type - The type of your object, e.g., "movie". See the complete list of supported types.
* og:image - An image URL which should represent your object within the graph. The image must be at least 50px by 50px and have a maximum aspect ratio of 3:1.
* og:url - The canonical URL of your object that will be used as its permanent ID in the graph, e.g., http://www.imdb.com/title/tt0117500/.
* og:site_name - A human-readable name for your site, e.g., "IMDb"
In addition, we've extended the basic meta data to add one required field to connect your page with :
* fb:admins or fb:app_id - A comma-separated list of either Facebook user IDs or a Facebook Platform application ID that administers this page.
It's also recommended that you include the following property as well as these multi-part properties.
* og:description - A one to two sentence description of your page.
------------------
Example:
Comment | File | Size | Author |
---|---|---|---|
#62 | nodewords-n803512-62.patch | 18.75 KB | DamienMcKenna |
#60 | nodewords-n803512-60.patch | 16.61 KB | DamienMcKenna |
#58 | nodewords-n803512-58.patch | 16.37 KB | DamienMcKenna |
#56 | nodewords-n803512-53.patch | 16.02 KB | DamienMcKenna |
#52 | nodewords-n803512-52.patch | 17.41 KB | DamienMcKenna |
Comments
Comment #1
ceefour CreditAttribution: ceefour commentedExample:
<meta property="og:site_name" content="Soluvas"/>
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedI am moving the feature request to the project that contains all the extra modules.
Comment #3
Exploratus CreditAttribution: Exploratus commentedsubscribe. Where was this moved???
Comment #4
benklocek CreditAttribution: benklocek commentedSubscribe. Wondering where also.
Comment #5
RasputinJones CreditAttribution: RasputinJones commentedHere you go. This is based on nodewords_nodetype.
You will need to update the core nodewords module to support outputting
<meta property...>
for og. Left as an exercise for the reader. :)We probably should make a separate project out of this.
Comment #6
4v4l0n42 CreditAttribution: 4v4l0n42 commentedSubscribing.
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #8
lolandese CreditAttribution: lolandese commentedRelated.
Comment #9
toomanypets CreditAttribution: toomanypets commentedPosted a custom module for adding Open Graph protocol meta tags here:
http://drupal.org/node/784904#comment-3582838
Comment #10
Dave ReidMarked #836282: Integrating Open Graph protocol tags and meta tags are not working as a duplicate of this issue. If we need to patch the nodewords API to support Open Graph meta tags, we need to know that or see a patch.
Comment #11
Dave ReidComment #13
sammys CreditAttribution: sammys commentedHere are two patches to bring Open Graphs support to nodewords. I've used the module posted in #5 as a base and:
It appears to be working nicely thanks to the hard work of the maintainers and testers getting nodewords ready for its next release. The API appears to be fairly easy to work with. Thanks to all of you!!!!
I'm marking this as 'needs review' so it gets reviewed by the community. Hope you all like it.
The module probably needs a bit more work on validation of the content and fine tuning the contexts but at least it works for now.
Comment #14
sammys CreditAttribution: sammys commentedGot too excited and hit the save button before uploading the patches hehe. Here they are.
Comment #15
sammys CreditAttribution: sammys commentedHere is an updated patch for adding meta property support. Just a small change to improve efficiency.
Comment #16
sammys CreditAttribution: sammys commentedOk. Some extra patch goodness ended up in the last patch so please use this one instead. It has been a LONG day. :)
Comment #17
dzepol CreditAttribution: dzepol commentedsubscribe
Comment #18
Anonymous (not verified) CreditAttribution: Anonymous commentedComments should have a final period.
It's enough to use
if (!$cached) {}
which works also if the value returned by the function is a boolean value, which is a value thecache_get()
function sometime returns.The placeholder should probably start with
@
.Comment #19
DamienMcKennaSeeing as this seems pretty simple and has some work on a patch, lets get this into the next release.
Comment #20
sammys CreditAttribution: sammys commented@kiam:
cache_get() will never return a boolean value. The only possible return values are an object or integer 0. The notes below the docs for cache_get() state we should check for expired cache data.
The placeholder doesn't need to use @ because the values are not coming from a non-code source. A ! placeholder executes faster.
Add a period? A truly discouraging request. The person committing the code can surely take that matter into their own hands. Must I point out the complete lack of "thank you for the patches"?
Here are the updated patches.
Comment #21
sammys CreditAttribution: sammys commentedThere appears to be a small bug preventing values saved for Facebook: AppID and Facebook: Admins from showing again in the admin forms. I'll fix this up asap.
Comment #22
ball.in.th CreditAttribution: ball.in.th commentedFYI, there's a similar module at http://drupal.org/project/opengraph_meta
Comment #23
Anonymous (not verified) CreditAttribution: Anonymous commented$value['labelsuffix']
is the value set from a module, which could also request the value to the user; that would be a reason to use@
instead of!
. Apart that, the variable could contain something that needs to be escaped before to be shown in HTML output.cache_get()
is the value returned from db_fetch_object(), which (when the database engine is MySQL) invokes mysql_fetch_object().As reported in the documentation for
mysql_fetch_object()
$cache === 0
would be evaluated toFALSE
, if the returned value isFALSE
.Comment #24
kafka93 CreditAttribution: kafka93 commentedSammy-- thanks for your efforts. I'm having a hard time getting it to work, though-- I'm not seeing any og fields show up in admin/content/nodewords -- is that where I should be looking? (I also don't see any og: tags added to the generated source). Any help/pointers to debugging would be much appreciated!
Comment #25
sammys CreditAttribution: sammys commentedHere is the updated patch with the FB App ID and Admins tags working properly. You need 803512_meta_property_20.patch from post #20 above along with this patch.
@kafka93: After you have applied the patches and installed the nodewords_og module you should be able to see the og fields in admin/content/nodewords. You then need to check the ones you want to see in edit forms and in the admin forms. After you've saved that you can edit the default values for those at admin/content/nodewords/default and then edit them on the node edit forms if you chose that option in the settings.
Comment #26
Bruno-2M CreditAttribution: Bruno-2M commentedsubscribe
Comment #27
naeluh CreditAttribution: naeluh commentedsubscribe
Comment #28
leahmd CreditAttribution: leahmd commentedsubscribe
Comment #29
naeluh CreditAttribution: naeluh commentedI tried to install nodewords_og module, because I am interested an putting this meta information my pages :
I installed the patches but I keep getting this fatal error
Is there an easy way to add custom og meta data, could I just add it the top of the page in the header thanks
Comment #30
cookiesunshinex CreditAttribution: cookiesunshinex commentedsubscribe
Comment #31
codevoice CreditAttribution: codevoice commentedAs of the date of this post, the opengraph_meta does NOT support the following tags:
og:url
fb:admins
There is apparently no intention to support the second one, which is of particular concern since it's required for getting a lot of opengraph to work with facebook.
So hopefully this saves someone else some wasted time testing the module.
Comment #32
Dave ReidOpenGraph <> Facebook - they are not the same things
It's the Facebook-specific implementation of OpenGraph that requires the fb:admins tag, so it should be a Facebook module that adds support for it.
Comment #33
amaria CreditAttribution: amaria commentedOn second thought I see that this is using the api...
Comment #34
Dave ReidBumping to 6.x-1.13 for now. I really, really want to get 6.x-1.12 out before we start adding new features.
Comment #35
mherchelsubscribe
..in the meantime I'll upgrade to the dev release to test.
Thanks for a great module!
Comment #36
joehudson CreditAttribution: joehudson commentedThe patches don't apply to 1.x anymore. But they do apply to 2.0-alpha1
I enable nodewords_og module, but no og meta options appear on the nodewords settings page!
Looking in nodewords_og.module I was surprised to see only
Don't those new inc files need including somewhere?
Comment #37
joehudson CreditAttribution: joehudson commentedSo far I can't find any way of getting this patch to work and the og features do not appear to be in the current dev 1.x or 2.x releases.. Nodewords has been really useful (thanks for the great module!), but I'm surprised there's not more demand for this feature. What other solutions do people use for Drupal?
Comment #38
lolandese CreditAttribution: lolandese commentedHi Joe,
"What other solutions do people use for Drupal?"
I use the Add To Head module. You have to define your og tags per page, but it's simple, lightweight and working. You can use it also for other purposes like inserting Javascript or CSS into the head section of the page. Until there is something better that's stable, I go with it.
Comment #39
joehudson CreditAttribution: joehudson commentedHi Martinus, thanks for that. Add To Head can certainly serve as a stop gap measure, until this patch is working.
Comment #40
tribe_of_dan CreditAttribution: tribe_of_dan commented@sammys Thank you so much for these patches. They work great!! :)
It was confusing for me at first but I got it working with 2.0-alpha1.
It would be great to add the functionality to add default fields by node type.
Comment #41
mherchelI'm attaching a patched version of 6.x-2.0-alpha1. This is manually patched, and it works for me.
Comment #42
mherchelComments after testing:
1. The token feature works great when specifying a CCK image on a content type that has an imagefield defined.
2. However, within the same D6 installation, when viewing a content type that does not have that particular imagefield associated with it, the module will generate the actual token in the OG Meta tag (example:
<meta property="og:image" content="http://localhost:8082/[field_image-filefield-filepath]" />
3. There needs to be 1) a way to enable/disable specific OG meta tags per content type, and 2) a way to specify different default tokenized meta tags per content type.
4. This is looking awesome! This is badly needed functionality for Nodewords, and I cannot wait till this gets committed. Great job!
Comment #43
DamienMcKennaI don't suppose you'd be interested in building a patch for 6.x-1.x? =) The status of the 6.x-2.x branch is still under debate.
Comment #44
mherchel@Damien - I wish. Unfortunately, my PHP skills are about as great as my handyman skills (which is to say practically non-existent).
I'm willing to test and help out in other ways if I can, though.
Comment #45
DamienMcKennaNeeds some work to backport it to the 6.x-1.x branch.
Comment #46
venusrising CreditAttribution: venusrising commentedWith all the new announcements about Open Graph today has anyone found a way to add these tags to Nodewords?
Comment #47
neilnz CreditAttribution: neilnz commentedI've done a backport of #20 and #25 to the 1.x-dev branch, but it had to lose tokens support, as it seems the 1.x branch no longer includes the nodewords_replace_tokens() function. I agree that this is a bit annoying, but looking at the release notes, it seems the token support was yanked and moved to 2.x (and then abandoned?).
This'll do for some people in the meantime though.
The patch also includes a fix to the current dev release that breaks node support:
Even though this isn't technically part of this feature, it's a bug that needs to be fixed in order for the current dev release to work.
Comment #48
ceefour CreditAttribution: ceefour commentedmetatag (nodewords replacement for Drupal 7.x) already has built-in support for Facebook/OpenGraph tags.
Comment #49
venusrising CreditAttribution: venusrising commentedThis issue is for Drupal 6 which many many sites still use.
Comment #50
neilnz CreditAttribution: neilnz commentedYeah agreed. Even if 2.x, with all its benefits, never sees the light of day, lots of people could benefit from being able to do OG with Nodewords, rather than one of the alternative modules, as they already use Nodewords for other tags.
Marking as needs review because I forgot to change the status when I reposted the patch for 1.x.
Comment #52
DamienMcKennaRerolled against the latest codebase, could someone please help test this, if it works right I'd really like to get it in the next release.
Comment #53
DamienMcKennaComment #55
DamienMcKennaI believe the failure is because it installs a new module so the testbot won't like it.
Comment #56
DamienMcKennaSeems it definitely needs work - the tags get saved correctly but nothing is displayed. Also, I've moved the new "properties" meta tag type to its own issue: #1359988: Allow for meta property tags, so this just deals with the new nodewords_og files (and the README.txt update).
Comment #57
venusrising CreditAttribution: venusrising commentedI would be happy to test if it worked again the 6.x-1.11 version as we cannot change to dev to to so many issue and instability.. We have a sandbox replicating our production site.
Comment #58
DamienMcKennaSome changes:
I've tested this one and there is data coming through, but maybe it should perform specific validation on each field?
Comment #59
DamienMcKennaI've tested this a bit and it is outputting the tags, I'm considering just adding this to the current version and then improve it in the next version with data validation & more logic. Thoughts?
Comment #60
DamienMcKennaAnother update, this makes the Site Name only editable in the Defaults, along with a few minor code tweaks.
Comment #61
DamienMcKennaBig gotcha with this - the HTML tag itself has to be customized, specifically it needs an xmlns definition added, otherwise XHTML validation will fail and the tags themselves may not work (I stopped looking into it when I identified the XHTML validation problem). Bummer. So now we're going to need to include a message in hook_install to hack the template file, along with instructions in the README.txt file.
Comment #62
DamienMcKennaThis patch includes a few more changes:
Not sure if anything else can be done at this point?
Comment #63
DamienMcKennaI decided to commit this after some initial testing which showed the tags to be at least outputting correctly, the question of whether the spec has changed since the patch was first written is a question for later.
Thanks to RasputinJones, sammys, mherchel and neilnz for their help with this, it really was a community effort :-)