Add a Twitter share link that validates

I found that my page wouldn’t validate at W3C Validator because of a Twitter button.

Here is a very easy way to make a Twitter button that does validate in Textpattern.

Make a form and paste in:

<p><a href="http://twitter.com/share?url=<txp:permlink />" class="twitter-share-button">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></p>

Then put:

<txp:output_form form="twitter" />

Wherever you want the button to appear.

The button opens a Tweet window with the page title and url already in place.

4 Comments - Comments RSS Feed

Timid
# 8 December 2011

Great! Thx!

Vladas
# 10 December 2011

It might worth to implement Twitter embedding API, too — it requires URL quoting only for a usen, like in http://savas.palubinskas.lt (currently on top of the page). I have made it following http://blog.posterous.com/introducing-embeddable-tweets (and an example on http://www.brownday.me/embeddable-tweets-now-on-posterous).

Mark
# 18 December 2011

All my tweet buttons show they’ve been tweeted twice. Shouldn’t they start with a zero?

Bisk
# 9 January 2012

Nice tip, thanks! I just implemented it.

Add a comment

Required

Required, not displayed

Optional

Use Textile Help to style your comments