Skip to content

Latest commit

 

History

History
151 lines (102 loc) · 4.37 KB

README.rst

File metadata and controls

151 lines (102 loc) · 4.37 KB

collective.behavior.featuredimage

A behavior for Dexterity-based content types to add a featured image for sharing content on social media.

Suppose you are running The Planet, a news portal that has a bunch of editors focused on getting news on different topics, like Economy, Health or Sports.

Sometimes your news have a great catchphrase, and you want to add more appeal in this phrase writing it into the image you share.

This package allows you to automatize this image creation with the text embedded, and set this image as a featured image of your news.

https://raw.github.com/collective/collective.behavior.featuredimage/master/docs/featuredimage-example.png

Featured Image example.

Got an idea? Found a bug? Let us know by opening a support ticket.

This package uses PhantomJS to create the featured image.

To enable this package in a buildout-based installation:

  1. Edit your buildout.cfg and add add the following to it:

    [buildout]
    ...
    eggs =
        collective.behavior.featuredimage
    
    parts =
        ...
        env
        node
    
    [env]
    recipe = collective.recipe.environment
    
    [instance]
    ...
    environment-vars +=
        PATH ${buildout:bin-directory}:${env:PATH}
    
    [node]
    recipe = gp.recipe.node
    npms = phantomjs-prebuilt
    scripts = phantomjs
    

After updating the configuration you need to run ''bin/buildout'', which will take care of updating your system.

Go to the 'Site Setup' page in a Plone site and click on the 'Add-ons' link.

Check the box next to collective.behavior.featuredimage and click the 'Activate' button.

Note

You may have to empty your browser cache and save your resource registries in order to see the effects of the product installation.

This add-on includes a behavior to add four extra fields on Dexterity-based content types:

Enabled
Used to indicate that this content should use the featured image. Enabled by default.
Quote
The catchphrase you want to be embedded into the image. Uses the title field (if available) by default.
Author
The author of the catchphrase.
Featured Image
The featured image generated. This field is read-only.

Add the base image in the control panel configlet.

https://raw.github.com/collective/collective.behavior.featuredimage/master/docs/featuredimage-controlpanel.png

Featured Image control panel configlet.

  • In 'Site Setup', select the Dexterity Content Types configlet
  • Select your content type
  • Go to Behaviors tab and select Featured Image

A new fieldset called Featured Image will be present in the edit form of your content type.

https://raw.github.com/collective/collective.behavior.featuredimage/master/featuredimage-behavior.png

Featured Image behavior in action.

The buildout configuration already installs PhantomJS and makes it available by updating the PATH environment variable.

We use yeoman and grunt to build static files, to start grunt watch run:

buildout_dir$ ./bin/grunt_watch

Then open the browser at http://localhost:9000 and edit the files at directory yeoman/app to customize the static files.

To build the static files run:

buildout_dir$ ./bin/grunt_build