MTLinkTitles

I wrote this plugin because I was feeling lazy. I did not want to track down the titles for all the pages I have linked to, so I wrote a plugin to do it for me. Introducing MTLinkTitles.

Download one of the following files, unpack it, and place link_titles.pl in your plugins/ directory.

Usage example:

<MTEntryBody link_titles="1">

link_titles

  • When this filter is applied, any anchor tag (i.e. <a href="blah blah">) that appears in the resulting text will be visited to gather the title of the page, which will then be added to the tag itself (e.g. title="Page Title").
  • The titles will be cached with MT::PluginData so that once a title is found, no further HTTP requests need to be made. If the title has changed and you would like to get the new one, just browse through the mt_plugindata table and delete the row with MTLinkTitles as the plugin value and the URL as the key.
  • If that doesn't work well for everybody, I'd be willing to work up another cache-clearing method.

Update (2003-06-08 11:27)

  • No, this will not override existing title attributes.

10 TrackBacks

LinkTitles from MT Plugin Directory on June 7, 2003 10:33 PM

Results are stored in the MT::PluginData table.... Read More

Colorblind from Iced-Glare.org on July 18, 2003 5:16 PM

I was watching VH1 Goes Inside: Awesome Movie Songs last night and now I have that song Colorblind - Counting Crows from Cruel Intentions stuck in my head. Anyway I added nice little plugin for MT (a while ago) that... Read More

Colorblind from Iced-Glare.org on July 18, 2003 5:16 PM

I was watching VH1 Goes Inside: Awesome Movie Songs last night and now I have that song Colorblind - Counting Crows from Cruel Intentions stuck in my head. Anyway I added nice little plugin for MT (a while ago) that... Read More

David Raynes: mtLinkTitles... Read More

Current version is 1.0.0.0 released on 2004-09-17 Contents What This Plugin Does Requirements Installation Instructions How To Use The Tags Frequently Asked Questions Examples License Download Version History Contact What This Plugin Does Audio bloggin... Read More

Current version is 1.0.0.1 released on 2004-09-20 Contents What This Plugin Does Requirements Installation Instructions How To Use The Tags Frequently Asked Questions Examples License Download Version History Contact What This Plugin Does Audio bloggin... Read More

Current version is 1.0.0.1 released on 2004-09-20 Contents What This Plugin Does Requirements Installation Instructions How To Use The Tags Frequently Asked Questions Examples License Download Version History Contact What This Plugin Does Audio bloggin... Read More

Current version is 1.0.0.1 released on 2004-09-20 Contents What This Plugin Does Requirements Installation Instructions How To Use The Tags Frequently Asked Questions Examples License Download Version History Contact What This Plugin Does Audio bloggin... Read More

Current version is 1.0.1.0 released on 2004-09-26 Contents What This Plugin Does Requirements Installation Instructions How To Use The Tags Frequently Asked Questions Examples License Download Version History Contact What This Plugin Does Audio bloggin... Read More

Current version is 1.0.1.0 released on 2004-09-26 Contents What This Plugin Does Requirements Installation Instructions How To Use The Tags Frequently Asked Questions Examples License Download Version History Contact What This Plugin Does Audio bloggin... Read More

8 Comments

what about links that already have title="" attributes? will it change them as well?

That's very useful, it's just that quite a lot of web sites don't provide a useful <TITLE> tag, so I end up fixing it by hand.

It somehow goes back to the previous comment, if an existing title attribute could override the automatic gathered one - I believe that would be the most useful behaviour.

That's very useful, it's just that quite a lot of web sites don't provide a useful <TITLE> tag, so I end up fixing it by hand.

It somehow goes back to the previous comment, if an existing title attribute could override the automatic gathered one - I believe that would be the most useful behaviour.

I get an error when I try to run the command.

An error occurred:

Can't call method "stash" on an undefined value at /home/jmevius/public_html/the/mt/plugins/link_titles.pl line 23.

Any ideas?

I'm using this plugin and I was wondering is there a way that this plugin can pull the titles from every link on the page besides the ones in MTEntryBody?

I found a nasty bug in this today that broke a lot of links on our site. When a URL uses bookmarks, the site URL is getting put into it. So the original HTML is:

And that gets formatted into the following with this plugin:

The quick fix was to change the code on line 70 to this:

if ($loc !~ /^http:/ && $loc !~ /^\#/) {

Hope this helps.

This times out my blog rebuilds whenever I try to use it--things rebuild verrrrrrry slowly and eventually time out with an error 500. Is there a way around this?

quite nifty, but what would be cool would be if one could have a LinkName plugin that actually sets the displayed hyperlink name as the page's title

Leave a comment

Recent Entries

  • Plugin Writing 101

    So, I’m planning on writing up some entries about various aspects of plugin development. While I have a couple topics already in mind, I thought...

  • The Olympics Make Me Want To Compete Again

    Every time the Olympics come around (most the summer ones) I always start to delude myself into thinking I could complete once again in the...

  • Minimalist plugins are fun!

    Last night I whipped up one of the smallest plugins I’ve ever written. It is so small in fact that I was able to stuff...

  • Feedburner Widget on MT News

    Movable Type News A WordPress 2.5 Upgrade Guide: And of course there are lots of third-party plugins for the MT dashboard, to integrate statistics and...

  • AD&D Monster Stats for the Presidential Canditates

    Charles Stross (scifi author, D&D nerd, and former perl columnist) posted Politics as she is Played with 3d6: The recent death of Gary Gygax, who...

Close