Twitter Cards - can they be used on demo or personal sites?

cards

#1

Hello Twitter Devs,

You guys helped me get my twitter share button working on my random quote machine with twitter web intents, thanks again, so much for that! I’m still using that as my learning space, and now I want to challenge my creativity, and see if I can use the twitter cards to share an image with the quote instead of just the text, since the 140 character limit restricts the quotes that can be used. That way the quote itself looks more appealing, and the 140 characters can be used for personal messages, hashtags, links, branding, etc.

I read the documentation several times, and tried to follow along, but ultimately the best I could do was end up with an error message about missing a URL parameter. I could not find anywhere in the list of required parameters, where it said to put a URL parameter. Is this because I’m trying to use cards on an unsupported platform, i.e., my local system?

How much different are cards from the tweet button functionality I already have implemented? Is this a completely different animal? Do I need to have my own twitter server running a twitter service or something, (I thought I read that somewhere in the forum)? I did purchase a few domains, so I can put something live if I need to, but I cannot make heads or tails out of the documentation - sorry, I just keep going in circles with it. I just need to know on a super high level, what I need to do, then I can get the ball rolling and come back for help if I get stuck on any details.


#2

You do need your page and URL to be publicly-accessible on the Web, yes. Having it just accessible to your local machine will not allow it to be accessed by our cards engine.

Where are you seeing the error message, and exactly what have you tried so far?


#3

I have only tried it locally so far, so that probably explains the error.

I added all the meta tags, (twitter:card, twitter:title, twitter:description, twitter:image, etc.) and only got the one error about a missing URL parameter when I tested using the validator, which makes sense now that I know it’s looking for me on the web. It will be easy for me to repeat the steps, all I need to do is copy over my files to my domain directories.

However, now that I’m looking over the documentation again, I think I need to use the Twitter API to upload photos, but the link to those instructions on the “Getting Started Guide” page is broken.


#4

No, you don’t need to upload photos to Twitter if you are adding them to your card page and have the image that you’re references in the twitter:image tag accessible by the card crawler. Thanks for spotting that broken link though! we will take a look at that.


#5

OK, cool! But just so I understand; the card image must be the exact image file used as the image displayed on-screen in the browser?
In other words, my idea was to keep using actual text on-screen, because it’s easier to control typography with CSS for sizing / scaling, different devices, browsers, etc., but the twitter card would be an image with the same text embedded into it, since cards are all the same dimensions and longer texts can be fit onto them without using up any of the 140 character limit.
Does that make sense? Can that be done with cards?


#6

Ah wait. I think you want to do something dynamic, so now I think cards are the incorrect choice for this. The reason is that for each quote, you would have to share a unique link to a new HTML page with new meta tags and a new image, and that won’t work well. My misreading / misunderstanding.

You may well want to use the media upload endpoint. There’s information on that page about the potential sizes / dimensions you’d be able to use. It’s a two stage thing, so you need to upload the image, get back a media ID, and then when you post the Tweet, you add the media ID as an additional parameter.


#7

OK great, I’m glad we cleared that up! Wow this will keep me busy for a while.

Thank you! I will let you know, after I give it a go, if I run into any problems.


#8

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.