Drupal Sharing Customization

Twitter Message

Using AddToAny templates, you can change the default message sent to Twitter.

var a2a_config = a2a_config || {};
a2a_config.templates = a2a_config.templates || {};
a2a_config.templates.twitter = {
    text: "Reading: ${title} ${link} by @AddToAny",
};

In Drupal, add the following JavaScript code to your "Additional JavaScript" box in Configuration > Web services > AddToAny > Additional Options.

In WordPress, add the following JavaScript code to your "Additional JavaScript" box in Settings > AddToAny.

a2a_config.templates.twitter = "Reading: ${title} ${link} by @AddToAny";

Use the ${link} and ${title} placeholders to designate where you want the shared link and title to be placed.


Endpoint Parameters

The Twitter template accepts a string value for simply specifying the default message (above), or an object value for specifying additional parameters (including a default text message).

You can suggest relevant hashtags and related usernames by customizing Twitter's endpoint parameters.

https://twitter.com/intent/tweet&text=&hashtags=&related=

a2a_config.templates.twitter = {
    text: "Reading: ${title} ${link}",
    hashtags: "sharing,social",
    related: "AddToAny,Twitter",
};

Tip: After a user Tweets, Twitter usually suggests "Who to follow." You can have a specific account suggested by mentioning the @account in your default message, or by specifying the account in the related parameter. Twitter will then suggest that account (if not already followed by the user). Up to two accounts can be suggested by mentioning them in your default message.