Support » Plugin: AddToAny Share Buttons » Link Generated with OG instead of Twitter Markup

  • Resolved zacdibble

    (@zacdibble)


    As it stands, when using the Twitter button to share a blog post, instead of using the Twitter markup it is using Open Graph for the title. I am using Yoast SEO which is responsible for generating the markup. So my initial thought was that it was generating the markup after AddToAny was loaded onto the page. However, I set Yoast to load before it and I got the same results.
    At this juncture I’m not sure where to go. I’ve attempted all basic potential solutions.

    Any help that can be provided would be fantastic.

    The page I need help with: [log in to see the link]

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

    (@micropat)

    The AddToAny floating bar uses the current page’s title by default. Using AddToAny events, you can force the meta[name="twitter:title"] tag to be used for the Twitter title.

    Add the following JavaScript to your “Additional JavaScript” box in AddToAny Settings:

    a2a_config.callbacks.push({
        share: function( data ) {
            if ( 'Twitter' === data.service && location.href === data.url ) {
                var title = document.querySelector( 'meta[name="twitter:title"] ');
                if ( title && title.content ) {
                    data.title = title.content;
                }
            }
    
            return data;
        }
    });

    Sorry for the delayed response. It has been pretty busy between work and the holiday. Hope yours went well. Anyways, this fixed it perfectly. Thanks a lot!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.