Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-03-04 19:49:24

mapu
Member
From: Munich, Germany
Registered: 2004-03-16
Posts: 141

[request] Tweet this! plugin

I’m sure there is also an easy solution via PHP like shown on Smashing Magazine (see Automatically create TinyUrls for your blog posts).

I’d like to have an easy solution or plugin that enables me to put a link or button below each article with which the reader can post the article title and link to Twitter. It is easy to do this with the raw permalink URL but sometimes the title of the article together with the URL is longer than 140 characters.

So it would come in handy if the permalink URL of the article could get shortened automagically via TinyURL or any other shortening service that offers such an external access.

Offline

#2 2009-03-05 08:21:57

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,538
Website GitHub Twitter

Re: [request] Tweet this! plugin

Hi

You can use messy url for that too: an article with id=XX can be vieweb by the link http://yoursite.com/index.php?id=XX

Cheers

Offline

#3 2009-03-05 08:50:44

mapu
Member
From: Munich, Germany
Registered: 2004-03-16
Posts: 141

Re: [request] Tweet this! plugin

Dragondz wrote:

You can use messy url for that too: an article with id=XX can be vieweb by the link http://yoursite.com/index.php?id=XX

This is a nice quick and dirty solution! :-) Thanks!

I think I’ll use this as long as there is no cleaner solution via plugin.

I guess it would be a good idea to implement then a canonical link to avoid duplicate content because of the clean vs. messy URLs which shoudn’t be much of a problem.

Edit: This should do the trick on article pages:

<txp:if_individual_article><link rel="canonical" href="<txp:permlink />" /></txp:if_individual_article>

Pls correct me someone if I’m wrong.

Last edited by mapu (2009-03-05 08:55:24)

Offline

#4 2009-03-05 11:31:15

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: [request] Tweet this! plugin

mapu wrote:

I’m sure there is also an easy solution via PHP like shown on Smashing Magazine (see Automatically create TinyUrls for your blog posts).

…in which the author shows how you can bring your WordPress site to a grinding halt by issuing a blocking HTTP request to a third-party service upon every page load without any caching at all, in no less than 15 different ways ;-)

But if you don’t mind the drawbacks: Yes, Virginia, there is a solution…

<txp:php>
$turl = file_get_contents("http://tinyurl.com/api-create.php?url=".permlink(array()));
echo 'Tiny Url for this post: <a href="'.$turl.'">'.$turl.'</a>';
</txp:php> 

(to be added to the article form)

Offline

Board footer

Powered by FluxBB