Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-04-01 13:21:34

jameslomax
Member
From: UK
Registered: 2005-05-09
Posts: 448
Website

twitter card plugin

Twitter has made a card plugin available for Wordpress

From what I’ve seen of this, I deduce that all the plugin does is insert twitter tags into the body of articles. I’ve been trying to do that manually at my site but can’t quite get it to work. It’s half working – Twitter finds the tags but is not inserting an excerpt or image.

Is anyone aware of this Twitter feature, knows how to implement it, or even interested in building a TXP plugin or modifting the WP one?

- or any other useful advice!

Offline

#2 2015-04-01 14:23:23

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: twitter card plugin

In case of Textpattern such widget plugin isn’t necessary, in fact not really even wise to do one. To implement a Twitter card on your website, you don’t need to do anything else than add few meta tags inside your head element. You can populate the meta tags with anything you want, using tags such as images, custom_field and so-on to your advantage. Like for instance:

<txp:if_individual_article>
    <meta name="twitter:card" content="summary" />
    <meta name="twitter:site" content="@yoursitetwitterusername" />
    <meta name="twitter:title" content="<txp:title />" />
    <meta name="twitter:description" content="<txp:custom_field name="description" />" />
    <meta name="twitter:url" content="<txp:permlink />" />

    <txp:if_article_image>
        <txp:images limit="1">
            <meta name="twitter:image" content="<txp:image_url />" />
        </txp:images>
    </txp:if_article_image>
</txp:if_individual_article>

See Twitter Card documentation for all available options, and you may use their validator to verify your implementation.

Offline

#3 2015-04-01 15:42:48

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: twitter card plugin

…and otherwise, arc_social_share and pat_article_social support twitter cards.

Edit: arc_social_share should be used with arc_meta for meta tags. <txp:arc_meta_twitter_card /> is your friend.

Last edited by NicolasGraph (2015-04-01 15:46:30)


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#4 2015-04-01 16:36:01

jameslomax
Member
From: UK
Registered: 2005-05-09
Posts: 448
Website

Re: twitter card plugin

OK thanks. I tried inserting those tags in the header and its not working. That seems to be the simplest way of doing it. I tried leaving in the <txp:if_individual tags and leaving them out – concerned Twitter might not work with them.

I’ll play around with those plugins and see if they work.

UPDATE: I’ve got the plugin solution working – almost.

There’s some odd behaviour however at Twitter. When you click “view summary” the card should open below. It doesn’t – the click takes you to the individual tweet, away from the Twitter front page.

I’ve no idea if that’s a txp plugin issue or an issue with the Twitter web site.

Last edited by jameslomax (2015-04-01 17:15:52)

Offline

#5 2015-04-01 17:32:27

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: twitter card plugin

jameslomax wrote #289647:

When you click “view summary” the card should open below.

Are you sure?

Last edited by NicolasGraph (2015-04-01 17:32:37)


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#6 2015-04-01 17:42:34

jameslomax
Member
From: UK
Registered: 2005-05-09
Posts: 448
Website

Re: twitter card plugin

Yes – that’s how how they work.

Offline

#7 2015-04-01 17:55:50

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: twitter card plugin

I can’t find one which works like you say (Le Monde, Étapes, etc.), but I’m not a twitter card specialist…


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#8 2015-04-01 17:59:32

jameslomax
Member
From: UK
Registered: 2005-05-09
Posts: 448
Website

Re: twitter card plugin

That’s strange – I’ve never seen that before except with my new card. I’ve been using Twitter extensively for 2 years.

Is it the same if you go to twitter.com and click ‘view summary’ for a tweet on the home page?
- because if I do that now the summary expands and I stay on that page. if I want it to close I see ‘Hide Summary’

Last edited by jameslomax (2015-04-01 18:02:38)

Offline

#9 2015-04-01 18:04:27

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: twitter card plugin

jameslomax wrote #289653:

Is it the same if you go to twitter.com and click ‘view summary’ for a tweet on the home page?

I don’t understand your question.


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#10 2015-04-01 18:12:59

jameslomax
Member
From: UK
Registered: 2005-05-09
Posts: 448
Website

Re: twitter card plugin

You referred to ‘view summary’ tweets at the channels of Le Monde and Etapes.
Strangely – I saw the same as you. Click ‘view summary’ and you go to another page where you find the tweet.

However – if I go to twitter.com and click ‘view summary’ on any random tweet it behaves as it should: the summary expands and you stay on that page.

- it seems odd, I don’t know why that’s happening, but it is (for me).

Last edited by jameslomax (2015-04-01 19:01:50)

Offline

#11 2015-04-01 18:17:16

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: twitter card plugin

jameslomax wrote #289655:

However – if I go to twitter.com and click ‘view summary’ on any random tweet it behaves as it should: the summary expands and you stay on that page.

What do you mean by twitter.com? The twitter homepage is a login page. Do you mean on your account page?
If it’s what you mean, it’s the same for me…

Last edited by NicolasGraph (2015-04-01 18:19:14)


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#12 2015-04-01 19:03:08

jameslomax
Member
From: UK
Registered: 2005-05-09
Posts: 448
Website

Re: twitter card plugin

No – I mean the home page where you see all you the channel tweets you follow.

UPDATE: OK I think I understand. if you click ‘view summary’ on the front page twitter.com the summary expands. if you click ‘view summary’ on a tweet at a channel – you go to another page.

That seems to be how Twitter works. I never noticed.

Offline

Board footer

Powered by FluxBB