Autolink URLs in MT Entries

Freshness Warning
This article is over 14 years old. It's possible that the information you read below isn't current.

One of the things I really hate about reading newspaper Web sites is they often include URLs but don’t link them. So you have to copy and paste to open them (or just rightclick with the right Firefox extension).

I don’t want my site to look like a big, dumb newspaper. So I wrote a filter using Brad’s regex plugin to autolink URLs in entries. It hasn’t been extensively tested but it has worked for a the half-dozen or so entries in the Project X blog.

Install the regex plugin and then add this to the top of your templates…

<MTAddRegex name="autolink">s![> ](http://[^<" ]+)!<a href="$1">$1</a> !g</MTAddRegex>

Then add the attribute regex="autolink" to your MTEntryBody and MTEntry more tags in your templates: <MTEntryBody regex="autolink">.

Trackback from Movalog Sideblog
August 16, 2004 10:32 PM

Autolink URLs in MT Entries

Excerpt: Autolink URLs in MT Entries...

Terrence Wood
August 17, 2004 5:35 PM

I don't have MT installed, but I think this regex will also replace existing links, and should read: s![^">](http://[^<" ]+)! <a href="$1">$1</a> !g

Trackback from Lummaland
August 17, 2004 11:27 PM

Plain Text Links

Excerpt: Die Extension Plain Text Links für Firefox ist unspektakulär, aber klasse. Für all die Websites, insbesondere Online-Ausgaben der Zeitungen, die nicht in der Lage sind, einen URL auch klickbar zu ma...

Adam Kalsey
August 18, 2004 11:38 AM

No, the [> ] in my original regex means that the pattern will only match URLs that immediately follow a > (the end of a tag) or a blank space. So it won't match a URL in an anchor tag.

peter
March 27, 2006 7:26 PM

For me, the regex you supplied only works on the first link immediately after a paragraph tag - and then it mucks up the paragraph tag like so: <p<a href= 'sup with that.

This discussion has been closed.

Follow me on Twitter

Best Of

  • How not to apply for a job Applying for a job isn't that hard, but it does take some minimal effort and common sense.
  • Movie marketing on a budget Mark Cuban's looking for more cost effective ways to market movies.
  • California State Fair The California State Fair lets you buy tickets in advance from their Web site. That's good. But the site is a horror house of usability problems.
  • Customer reference questions. Sample questions to ask customer references when choosing a software vendor.
  • Comment Spam Manifesto Spammers are hereby put on notice. Your comments are not welcome. If the purpose behind your comment is to advertise yourself, your Web site, or a product that you are affiliated with, that comment is spam and will not be tolerated. We will hit you where it hurts by attacking your source of income.
  • More of the best »

Recently Read

Get More

Subscribe | Archives

Recently

Assumptions and project planning (Feb 18)
When your assumptions change, it's reasonable that your project plans and needs change as well. But too many managers are afraid to go back and re-work a plan that they've already agreed to.
Feature voting is harmful to your product (Feb 7)
There's a lot of problems with using feature voting to drive your product.
Encouraging 1:1s from other managers in your organization (Jan 4)
If you’re managing other managers, encourage them to hold their own 1:1s. It’s such an important tool for managing and leading that everyone needs to be holding them.
One on One Meetings - a collection of posts about 1:1s (Jan 2)
A collection of all my writing on 1:1s
Are 1:1s confidential? (Jan 2)
Is the discussion that occurs in a 1:1 confidential, even if no agreed in the meeting to keep it so?
Skip-level 1:1s are your hidden superpower (Jan 1)
Holding 1:1s with peers and with people far below you on the reporting chain will open your eyes up to what’s really going on in your business.
Do you need a 1:1 if you’re regularly communicating with your team? (Dec 28)
You’re simply not having deep meaningful conversation about the process of work in hallway conversations or in your chat apps.
What agenda items should a manager bring to a 1:1? (Dec 23)
At least 80% of a 1:1 agenda should be driven by your report, but if you also to use this time to work on things with them, then you’ll have better meetings.

Subscribe to this site's feed.

Contact

Adam Kalsey

Mobile: 916.600.2497

Email: adam AT kalsey.com

Twitter, etc: akalsey

Resume

PGP Key

©1999-2019 Adam Kalsey.