Support » Plugin: AddToAny Share Buttons » Remove separator and site name from Twitter message

  • Resolved myproverbialthoughts


    First off, as a non-developer I can’t stress enough how much I appreciate the customization resources you’ve made available! I am getting stuck in a couple of areas, however, and am hoping someone can help.

    For the Twitter message, right now I’m using a2a_config.templates.twitter = “${title} ${link} via @mysite“; which outputs: Page Title | My Site via @mysite

    But I’d like the Twitter Message to simply be: Page Title via @mysite without the separator and site name.

    How do I solve for this?

    Thanks in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author micropat


    You can modify the shared title using AddToAny Events. For example, add the following code to your “Additional JavaScript” box in AddToAny Settings:

        share: function(data) {
            if (data.service === 'Twitter') {
                return {
                    title: data.title.replace(' | My Site', '')

    In the example, all occurrences of | My Site will be removed from the title when shared to Twitter.

    If you want to make sure that ” | My Site” is only ever replaced when at the end of the title, the “regular expression” syntax is a little trickier: you would use / \| My Site$/ instead of ' | My Site' in the example above.

    Thanks! I really appreciate the quick response.

    Can I use something similar for the text that gets pushed to Buffer?

    Plugin Author micropat


    Yep, for Buffer too. Just change:

    if (data.service === 'Twitter') {


    if (data.service === 'Twitter' || data.service === 'Buffer') {

    That worked great. Thanks again!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove separator and site name from Twitter message’ is closed to new replies.