Skip to content. | Skip to navigation

Adding ShareThis to a Plone Site

Plone's default Document Actions of "Send This" and "Print This" appear as text links in the bottom of the body content. 

docactions

To add ShareThis, it is necessary to modify the template which controls this viewlet.

Step 1. Create an account at ShareThis and use the Basic wizard to create the javascript embed code.

For this example, I generated the following code:

<script type="text/javascript" src="http://w.sharethis.com/button/sharethis.js#tabs=web%2Cpost%2Cemail&amp;charset=utf-8&amp;style=default&amp;publisher=66a4a04a-cdcf-44ba-9b02-7227f938c209"></script>

Step 2. Through the ZMI, customize <portal>/portal_view_customizations/zope.interface.Interface -- plone.abovecontenttitle.documentactions/

Alternatively, in the file system, look for document_actions.pt.  You can create and customize a new viewlet to replace the default functionality.

Step 3. Insert the ShareThis Javascript into the Plone viewlet template

<div class="visualClear"><!-- --></div>
<div i18n:domain="plone"
     class="documentActions">
    <tal:docactions tal:condition="view/actions">

    <h5 class="hiddenStructure" i18n:translate="heading_document_actions">Document Actions</h5>

    <ul tal:define="normalizeString nocall: context/@@plone/normalizeString">
    <li>
<script type="text/javascript" src="http://w.sharethis.com/button/sharethis.js#tabs=web%2Cpost%2Cemail&amp;charset=utf-8&amp;style=default&amp;publisher=66a4a04a-cdcf-44ba-9b02-7227f938c209"></script>
    </li>
    <tal:actions repeat="daction view/actions">
        <li tal:attributes="id python:'document-action-' + normalizeString(daction['id'])">
            <a href=""
               tal:attributes="href daction/url;
                               title daction/description"
               tal:content="daction/title">
            </a>
        </li>
    </tal:actions>

    </ul>
    </tal:docactions>

    <div tal:replace="structure provider:plone.documentactions" />

</div>

Step 4. The ShareThis function supersedes the need for Send this so the visibility of the Send this function can be disabled in the <portal>/portal_actions tool.

Examples

Boston.com, Dogtime.com, AccessHollywood.com, SparkPeople.com and FoxBusiness.com

References

Hiding ’send this’ and ‘print this’ in Plone 3.1+

 ShareThis Website

Document Actions