Metadata

Distro Index Owner:
eea
Home Page:
collective.opengraph
License
GPL
Version:
1.1rc2
Last updated:
2018-07-04
Keywords:

collective.opengraph

Files

Indexes

Plone opengraph integration

collective.opengraph

https://travis-ci.org/collective/collective.opengraph.png https://coveralls.io/repos/collective/collective.opengraph/badge.png

This package is a part of the Plone's collective.fg bundle. It adds the opengraph metadata to your HTML head section.

Supported metadata:
  • og:site_name name of the site
  • og:url url of the webpage
  • og:title title of the webpage
  • og:description description of the webpage
  • og:image your webpage image (either 'image' field of your context or collective.contentleadimage one)
from the control panel you can manage following settings:
  • the default og:type
  • which content types should be opengraph metadata aware
  • if opengraph metadata should be enabled sitewide for all content types

Customization

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"
   />

Changelog

1.1.rc2 (2018-07-04)

  • Fixed case when the image field exists, but does not contain anything [alecghica]
  • Fixed case when thumbnail is None [alecghica
  • Added sitewide enabling bypassing need to enable per document [ichim-david]
  • Avoid catalog search when sitewide isn't enabled and we need to update both new and old selected content types [ichim-david]

1.1.rc1 (2017-05-26)

  • Plone 4.3 compatibility [erral]
  • Added german translations. [Julian Infanger]
  • Register locales directory. [Julian Infanger]
  • Support Dexterity content types [simahawk]

1.0.1 (2012-10-16)

  • Docs update and fixed manifest file [amleczko]

1.0 (2012-10-15)

  • refactored and release during PloneConf2012 sprint [amleczko]

0.1dev (unreleased)

  • added action to (un)mark 'IOpengraphable' content types
  • added translations
  • registered viewlet for 'IOpengraphable' content types
  • added og:type meta tag
  • added default configurations in IRegistry
  • first release