This blog post shows how to integrate some of Facebook features to your Plone site programmatically.
See the add-on
for non-programming integration.
OpenGraph metadata
OpenGraph is Facebook page metadata protocol. You’ll insert extra <meta> tags on the page which will give additional information about the page to be displayed with Facebook links.
Below is an example of filling in Facebook metadata
- Using content description in Facebook
- Having main image
- Having location
- Having contact info
Example
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
lang="en"
metal:use-macro="here/main_template/macros/master"
i18n:domain="saariselka.app"
>
<tal:comment replace="nothing">
<!--
We will insert this HTML to <head> section,
"head_slot", defined by Plone's main_template.pt
-->
</tal:comment>
<tal:facebook-opengraph metal:fill-slot="head_slot" >
<meta property="og:description" tal:attributes="content context/Description"/>
<meta property="og:type" content="hotel"/>
<tal:comment replace="nothing">
<!--
Fill in geo info if available.
-->
</tal:comment>
<tal:has-location omit-tag="" tal:define="lat view/data/Latitude|nothing; long view/data/Longitude|nothing;" tal:condition="lat">
<meta property="og:latitude" tal:attributes="content lat"/>
<meta property="og:longitude" tal:attributes="content long"/>
</tal:has-location>
<tal:comment replace="nothing">
<!--
Fill in contact info.
-->
</tal:comment>
<meta property="og:email" content="xxx@yoursite.com"/>
<meta property="og:phone_number" content="+ 358 123 1234"/>
<tal:comment replace="nothing">
<!--
URL to 70 px wide image used by Facebook as the news item splash image.
Note: Facebook resized the image automatically.
-->
</tal:comment>
<tal:has-image omit-tag="" condition="view/main_image">
<meta property="og:image" tal:attributes="content view/main_image"/>
</tal:has-image>
<tal:comment replace="nothing">
<!-- Facebook admins is a compulsory field. Put here the side admin Facebook id(s), comma separated
http://apps.facebook.com/whatismyid
-->
</tal:comment>
<meta property="fb:admins" content="123123" />
</tal:facebook-opengraph>
Get developers
Subscribe mFabrik blog in a reader
Follow me on Twitter

