Galley card not appearing in timeline


#1

Hi, I’m aware that gallery cards don’t appear on the timeline by default, one must click on ‘View Details’.

However, on the troubleshooting (https://dev.twitter.com/cards/troubleshooting#timeline), some alternatives are proposed. The only solution that could apply to my situation is the second one:

‘For photos and animated GIFs, upload the media directly with the Tweet or consider using the Twitter API to upload media.’

I don’t quite understand how I should upload the photos in the tweet, does this mean I should include their urls there too? I’d appreciate it if someone could shed some light on this.

P.S: I’m getting an ‘Access denied’ message when trying to access the API.


#2

You’d use the button to attach an image to the Tweet, which would cause the images to be uploaded to Twitter.

If you’re getting an access denied message, have you authenticated? You probably don’t need to be using the API if you are just trying to post a card.


#3

Thank you for your answer, I’d like some more explanation though.
I can clearly see that there is a button for uploading images when using Twitter.
How do I actually use it from my website though?

All answers I’m finding suggest using cards or seem outdated (How to include an image using Tweet Button from my website,).

On the denied access: yes, I’m authenticated, I’ve also tried logging out and in again.


#4

I’m not sure. This implies you are trying to do something embedded in your website? I’m confused about what you’re trying to achieve. Can you walk us through it step by step?


#5

Sure, sorry if I haven’t been clear enough.

I’m using a twitter button on my site to share the content of another page.
The site with the button on it has:

1 The button itself

<a 
  href="https://twitter.com/share"
  class="twitter-share-button"
  data-url="http://witei.com{% url 'static_house_detail' house.pk %}"
  data-count="none"
  data-text="My text">
  data-hashtags="my tags}">
    Tweet
</a>

2 The script to go with it

<script>
  !function(d,s,id){
    var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';
    if(!d.getElementById(id)){
      js=d.createElement(s);
      js.id=id;
      js.src=p+'://platform.twitter.com/widgets.js';
      fjs.parentNode.insertBefore(js,fjs);
    }
  }
  (document, 'script', 'twitter-wjs');
</script>

Then the page it shares (the one up in data-url) has the following meta tags:

> <meta name="twitter:card" content="gallery" />
> <meta name="twitter:title" content="My title"
> <meta name="twitter:description" content="My description"/>
> <meta name="twitter:url" content="http://www.witei.com{% url 'static_house_detail' house.pk %}" />
> {% for i in house.pictures.all|slice:":4" %}
>   <meta name="twitter:image{{forloop.counter0}}" content="http://www.witei.com{{ i.pic.url }}">
> {% endfor %}

This takes up to four images and uses them for the gallery card. It’s working just fine, but the card doesn’t show expanded in the timeline and I’m looking for some way to be able to share the images and have them show on the timeline.


#6

this is correct - Cards are not expanded in the timeline - you have to click into the detail of the Tweet, unless the Tweet is promoted via the Ads platform. This is behaving as expected.


#7

Yes, so I was wondering if the second solution on the troubleshooting for this (https://dev.twitter.com/cards/troubleshooting#timeline) could be applied to my case and how.


#8

You mean:

For photos and animated GIFs, upload the media directly with the Tweet

Simply attach the images to the Tweet when you create it (either on web or on mobile) and they will appear in the timeline.


#9

Yes, that’s what I meant.
There’s no way to do it using the button from my website then? (Only a ‘tweet’ button shows up)


#10

There’s no way to add images to Tweets generated / posted from the embedded Tweet button, no.