addOpenGraphData: Open Graph Protocol in Fork

With the 2.6.0-release we introduced some new methods to handle meta-information:

  • addLink: add a link-item (e.g.: stylesheet, rssfeed, ...)
  • addMetaData: add a meta-tag (e.g.: keywords, robots, ...)
  • addMetaDescription: add a meta-description
  • addMetaKeywords: add meta-keywords
  • addOpenGraphData: add Open Graph data

I'm not going to explain each of these methods in detail. They are pretty self-explanatory. All you should know is that they won't overwrite the current value, unless you tell them to do so. This is for all meta-tags, except for the meta-keywords-tag, meta-description-tag and meta-robots-tag. For these specific items the value will be appended.

One method I want to explain somewhat more in depth: addOpenGraphData.

What is the Open Graph Protocol?

The Open Graph protocol enables any web page to become a rich object in a social graph. For instance, this is used on Facebook to enable any web page to have the same functionality as a Facebook Page.

Basicaly it means that you add some info into the HTML of your page, that other websites (like Facebook) can use to build a correct and rich snippet of your site.

What about Fork?

In Fork it is implemented by default in the Blog-module. The only thing you need to do is add your Facebook profile-id in the Settings-tab. When that is done, you can check the source-code for a blog-article. If you look in the head-section you will see all Open Graph data is present.

How can I do this in my own module?

The only thing you need to do is using the addOpenGraphData-method. It has 3 arguments:

  • $key: the Open Graph-property (you don't need to include the og:-part).
  • $value: the value for the property.
  • $overwrite: should the current value be overwriten. In most cases this will be true.

How can I verify the result?

If you put a lot of time in setting the correct tags, it would be nice to verify the result. Well, at https://developers.facebook.com/tools/lint you can test your page.

So if you are building a new module, try it out and make it easy to share the correct content on Facebook (or any other platform that supports Open Graph Data). If you have any questions or remarks, feel free to post them below.

Read More

Pub/sub in Fork

  • Written by Tijs Verkoyen on Tuesday 12 July 2011
  • 4 comments

With the new release we introduce the initial version of the pub/sub-system. Publish/subscribe (pub/sub in short) is a pattern where sender (publishers) trigger an event, whereon receivers (subscribers) can subscribe. With this mechanism modules can be looselyy linked and are able to interact on certain events.

Read more on the technical detail in the full post.

Read More

Enable Social Tracking

  • Written by Tijs Verkoyen on Friday 1 July 2011
  • 4 comments

In Fork 2.4.2 we will introduce automagical Google Analytics Social tracking. Although 2.4.2 is yet to be released (Tuesday July 5), We want to give a quick intro on how to enable this new feature. (If you can't wait to integrate it into your personal site, you can download the code on Github)

Read More