Need someone to lead product management at your software company? I create software for people that create software and I'm looking for my next opportunity. Check out my resume and get in touch.

Autolink URLs in MT Entries

Freshness Warning
This blog post is over 19 years old. It's possible that the information you read below isn't current and the links no longer work.

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.

Recently Written

Too Big To Fail (Apr 9)
When a company piles resources on a new product idea, it doesn't have room to fail. That keeps it from succeeding.
Go small (Apr 4)
The strengths of a large organization are the opposite of what makes innovation work. Starting something new requires that you start with a small team.
Start with a Belief (Apr 1)
You can't use data to build products unless you start with a hypothesis.
Mastery doesn’t come from perfect planning (Dec 21)
In a ceramics class, one group focused on a single perfect dish, while another made many with no quality focus. The result? A lesson in the value of practice over perfection.
The Dark Side of Input Metrics (Nov 27)
Using input metrics in the wrong way can cause unexpected behaviors, stifled creativity, and micromanagement.
Reframe How You Think About Users of your Internal Platform (Nov 13)
Changing from "Customers" to "Partners" will give you a better perspective on internal product development.
Measuring Feature success (Oct 17)
You're building features to solve problems. If you don't know what success looks like, how did you decide on that feature at all?
How I use OKRs (Oct 13)
A description of how I use OKRs to guide a team, written so I can send to future teams.

Older...

What I'm Reading

Contact

Adam Kalsey

+1 916 600 2497

Resume

Public Key

© 1999-2024 Adam Kalsey.