HashTag Plugin
The HashTag plugin is yet another twitter plugin. It will Tweet the entry title and a link using the account in the plugin settings, it can also add hashtags to your tweets. Hashtags are Twitter's version of tags, they provide a way of adding structure to your tweets and allowing people to filter tweets against their interests.
It was written because I was always forgetting to add #mt to all my MT related blog post tweets, which in turn meant that they were being missed by HashMT which collates all the #mt posts onto a single site.
Download
The latest version of HashTag can be downloaded from http://www.composing-stick.net/projects/hashtag/HashTag.zip. NOTE this version is for MT4.x. There will be a separate version released for MT5.x as there are some changes to the edit entry screen which means that the tweet options are not displayed correctly.
Installation
Copy the HashTag directory to your Movable Type plugin directory.
Configuration
- Log onto Movable Type and select your blog.
- From the top menu select Tools > Plugins.
- From the list of plugins select HashTag 2.5 and click on settings
Enter your Twitter username and password. This is the account that will be used for all tweets from this blog.
Introduction: this will prefix all your your tweets.
Hash Tag: This is the default hashtag that will be used for all your tweets.
Select your default tweet option, this can be overridden when posting an entry or creating a new page.
Don't forget to save changes.
Usage
When you create or edit an entry or page, you will see the HashTags options on the right hand side of the edit area. This allows you to override your default settings. If you select Tweet tags as hashtags then all the tags will be used except private tags (tags that start with the @ symbol) which will be ignored. Tags with spaces in their name will be have the spaces removed, this is the same as the normalisation that Movable Type does in the background.
You can add a set of links at the bottom of you entries that will search Twitter for tweets with the same HashTags. Add the following code to your entry template (see samplecode.txt in the HashTag plugin folder)
<mt:EntryIfTagged>
<div class="entry-tags">
<h4>Tags<span class="delimiter">:</span></h4>
<ul>
<li><mt:EntryTags glue='<span class="delimiter">,</span></li> <li>'>
<a href="javascript:void(0)"
onclick="location.href='http://search.twitter.com/search?q=%23
<$mt:TagName normalize="1"$>';return false;" rel="nofollow">
<$mt:TagName$></a>
</mt:EntryTags>
</li>
</ul>
</div>
</mt:EntryIfTagged>
History
Version 2.5
Current version.
Removed default intro if blank.
Removed dependency on XML::Atom.
Changed post override options from radio group to single select list to save space.
Added support for scheduled posts. NOTE: Schedule posts will always use the plugin default settings at the time the post is published.
Refactored duplicate code into functions.
Check for Movable Type proxy configuration. Thanks to Alvar Freude for supplying patch to do this.
Version 2.0
Added option to treat entry and page tags as HashTags.
Help from Jay Allen to make sure HashTags was using functions already in Movable Type rather than re-inventing the wheel.
Version 1.0
Original version, based on Ian Fenn's mt-twitter plugin
Added option to include a default HashTag when tweeting
Thanks. This is an excellent plug-in and works like a charm.
If you are going to enhance it any, what would help us is a many-to-many capability. We have multiple blogs with multiple authors and multiple twitter handles.
Thanks,
The next version (sometime in May) will have support for multiple users in one blog. I have a look at multiple twitter handles, but that will probably be for version 4.
Hey, I tried using this plugin (as well as two or three others I've found). None of them work, and I'm 100% sure the login information is correct.
Do you have any idea why this would not be updating? I'm using mt 4.23, and these plugins are pretty easy to install, I get prompted, my entry is made, but the tweet is never made.
Any ideas where to look?
Either the credentials aren't valid, or you're missing XML:Atom maybe.
Is there anything in the system or blog activity logs?
Credentials are definitely valid, I confirmed it by logging in at the twitter site. I looked in my activity log, and there's an obscenely long error dialog, which I'd rather not post here, as it has true paths for my server.
I'd send it to you in email, but I don't know how to do that.
I'll try replacing the XML:Atom file, which I was pretty sure was there, see if it makes any difference.
Hmmm. I updated to current MT (4.25). The plugin still isn't giving me a response, but now it has nothing in the activity log.
XML:Atom is there - or at least I believe it is. I installed a new fresh version tonight, so if it's in there, I should have it.
If you paste the content of the log page into an email. I will have a look.
Is there any way to have the plugin trigger and send Tweets when scheduled posts are made?
I have not been able to find a Twitter plugin that will post when the publishing event happens in the background.
Thanks!
Ron
It should just be a question of registering with the correct callbacks to enable that functionality.
I will have a look to see what can be done.
For what it's worth, I was having similar problems as Dopefish. It turns out that I don't have XML::Parser installed on my server, and don't really have the option to install it.
So I poked around in the plugin, to see if I could work around references to XML::Atom:Entry (which requires XML::Parser). Let me preface this by saying that I am both a Perl and MT Plugin n00b, so please jump in if I need to be corrected -- but after looking at the code, it seemed like that object wasn't really used for anything in particular except to temporarily store the title of the entry.
So I ended up commenting out lines 56, 57 and 58 (the lines that create an XML::Atom::Entry object). And then replacing the 3 references to "$entry->title" with "MT::I18N::encode_text( $obj->title , $enc, 'utf-8' )".
It's working just fine for me now. Though I'd also be interesting in binding the twitter updates to entry publishing rather than saving, but I'm not sure that there is an event tied to publishing an entry.
Again, someone please let me know if I'm overlooking some important aspect of that entry object.
Thanks!
Thanks for the feedback. The XML::Atom::Entry was from the plugin I used as a base. As it worked I didn't look further.
I will post a v3 Beta next week which will include your suggestion.
Oddly enough, under MT 4.26 I'm seeing the same error with this plugin as I am with MT-Twitter 1.0:
HashTag died with: Undefined subroutine &URI::Escape::escape_char called at /usr/home/caino59/public_html/cgi-bin/managed -mt/extlib/URI/_query.pm line 48.
Now, MT-Twitter 1.0 did not work prior to the 4.26 upgrade, but I've searched the error logs and there are no relevant errors whatsoever for version 4.25, so I'm still stuck in the same spot with it not working...but at least I have errors now.
XML::Atom is installed and the credentials had been checked about a million times. If there's any direction you think you can point me in, it'd be awesome.
Thanks I will take a look.
Have you found the right triggers/callbacks for tweeting when scheduled posts are published? I'm very interested in this functionality.
I will be releasing a beta in the next few days that includes support for schedule posts.
Would seriously love to be able to choose option to tweet w/ default hash tag in plugin settings for the blog without having it tweet for every save of a post including edits (without having to un-check in entry edit screen).
I.e., if there were an option in blog plugin settings to "tweet only first save" or something like that.
I have a look at that, at the moment tweet options are not saved with the posts (that is why scheduled posts always use the default settings) but it is something that I am considering for the future.
This is really useful. Thanks. Wondering if there is any way to shorten the URL in the tweet using bit.ly or any of the other tools?
thanks again.
At the moment it relies on Twitter to do the shortening, they apply some voodoo to decide when to shorten. I have had a few people ask for this feature and it is something I am thinking about. My main concern is time taken to communicate with two web services and the impact on publishing times.
I am currently testing a major update to the HashTag plugin as Twitter will stop supporting Basic Authentication in August. The update will include bit.ly integration.