djangotwittersharethis

Sharethis Twitter share image not loading


When using Sharethis to share a post from my website, the Twitter share button is unable to grab a dynamically generated image for the post. I have also included the link to the image in the head with "twitter:image" but the problem seems to persist. Any idea how to go around this?


Solution

  • this is an example of metatags to twitter in Django:

    in between place:

    <meta name="twitter:card" content="summary_large_image"/>
    <meta name="twitter:description" content="Place your card description here"/>
    <meta name="twitter:title" content="Card TITLE here"/>
    <meta name="twitter:image" content="{{SITE_PROTOCOL_URL}}{% static 'location of the image in static files' %}"/>
    

    where SITE_PROTOCOL

    context = {
       'SITE_PROTOCOL_URL': request._current_scheme_host,
    }
    

    In this LINK you can find the twitter card validator debugger

    the content url for twitter:image in this example would be:

    https://your-site.com/media/your_image_name.jpg

    Hope I could help.

    Note that will only work in a "live web" context