Absolute Links, Runtime (Plugin for WordPress)

If you, like me, type in relative URLs to images and links that are local to your server, you probably didn’t know that means images in your feed are broken. Feeds require absolute URLs for both your images and your links.

This plugin is super minimalistic. It simply looks for any relative URLs you have written, images and links alike, and makes them absolute. This is done after you’ve saved your posts, but before they are shown, so there’s no need to update all your old posts. Just activate the plugin, and voila.

Before:

<a href="/photostream/albums/various/cow.png">
	<img src="/photostream/albums/various/cow.png" alt="" />
</a>

After:

<a href="http://noscope.com/photostream/albums/various/cow.png">
	<img src="http://noscope.com/photostream/albums/various/cow.png" alt="" />
</a>

Download Absolute Links, Runtime

Responses to “Absolute Links, Runtime (Plugin for WordPress)”

  1. Isn’t “media/cow.jpg” a relative path and “/media/cow.jpg” absolute?

  2. Levi says:

    Nice idea Joen, I always forget about people coming in from feed readers and other external sources.

    If I get a chance I might play with this at home, see if I can get some simple regex going to detect for URLs that don’t start with “http://”, “ftp://” or other protocols and then selectively replace all links with full URLs.

Leave a Reply