Plone opengraph integration
This package is a part of the Plone's collective.fg bundle. It adds the opengraph metadata to your HTML head section.
One of the goals of this package is to allow developers extend the default metadata definition. It's availabe through the IOpengrapMetatags adapter:
from collective.opengraph.interfaces IOpengraphMetatags
from collective.opengraph.viewlets import ATMetatags
class MyATMetatags(ATMetatags):
implements(IOpengrapMetatags)
@property
def metatags(self):
tags = super(MyATMetatags, self).metatags
tags.update({'og:newtype': 'custom value'})
return tags
You can also customize existing og values:
from collective.opengraph.interfaces IOpengraphMetatags
from collective.opengraph.viewlets import ATMetatags
class AnotherMetatags(ATMetatags):
implements(IOpengrapMetatags)
@property
def title(self):
return '%s - Lorem ipsum' % self.context.Title()
Once your class is declared (let's say in a viewlets.py file), add the following adapter tag within your overrides.zcml file:
<adapter
for="Products.ATContentTypes.interface.interfaces.IATContentType"
factory=".viewlets.MyATMetatags"
provides="collective.opengraph.interfaces.IOpengraphMetatags"
/>
- refactored and release during PloneConf2012 sprint [amleczko]