Drupal 7 Pathologic Module

By shane
Thu, 2012-11-29 21:41
0 comments
Daily Dose of Drupal Episode #57

The Drupal 7 Pathologic module is a simple module that can be added to a text format to alter paths that might otherwise get broken. This can be very helpful when moving domain names for a website or in a recent situation for me, to fix relative links in an RSS feed.

In this episode you will learn:

  • Situations in which the Drupal 7 Pathologic module can be used for
  • How to turn on the Drupal 7 Pathologic input filter on the Text formats administrative screen
  • How to view that the Pathologic input filter is working on an RSS feed

Welcome to another Daily Dose of Drupal, my name is Shane, you can follow me on Twitter @smthomas3, you can also go to codekarate.com and sign up for the newsletter if you haven’t already. Okay we’re on Episode Number 57 today of the Daily Dose of Drupal.

Today we’re going to look at the Pathologic Module. This is a very simple module; well it just had a few simple purposes. If you read here it’s an input filter that can be used in Drupal and what it does is it allows you to handle moved websites or broken links especially as it has to do with our RSS Feeds if you use relative links rather than the Absolute links.

I notice this problem actually on my blog recently in one of my previous post where I had a relative image, I believed it is in one of this past post here I had a relative image link or the link to the image was based in a relative path rather the in the absolute path. So when it pulled in to the Drupal planet feed the image was broken. This module is designed to solve that problem.

I’m going to show you on a Drupal 7 site today how it can work; it’s a little bit hard to demonstrate exactly how it works but I’m going to show you how to get it installed and get it working. So the first thing we’re going to do is hop into our command line and download the module so we’ll go ahead and download it and enable it, you can see if we come in here and we search for it has been downloaded and enabled, we’re going to go ahead and go to the Configuration page and we’re going to go into follow the directions.

There’s a complete installation and configuration guide here which tells you some of the use cases and you can go into a little bit more detail and it tells you how to install this module. So we’ll go ahead and hop back over to the website which for some reason seems to be taking an extremely long time to load the configuration page but there it goes, we’ll click on Text Formats, we’re going to go into our Filtered HTML and hit Configure and we’re going to click on this Enable Filter here, that says correct URL’s with pathologic, as you can see it drops into this filter processing order segment down here and if you read number 3 installation steps it says check the box next to pathologic, scroll down and make sure that it’s at the bottom of the list.

So go ahead and make sure it’s at the bottom, click Save and you are good to go. You can add this on multiple text formats so if you want it on full HTML you can add it in there as well but we just added it to the filtered HTML. So as an example of the link that might be broken let’s go ahead and I have two articles here; because this link here is a relative link, pathologic is going to help solve this problem.

So now it’s one of those modules you pretty much install it and you can forget about it. It just knows how to handle relative links and if you end up moving website with and you have absolute links or you have relative links and it’s pulling through an RSS feeds we’re going to make sure that those get pulled through correctly. And just to show an example of how this works we’re going to go ahead and come in here and turn off the pathologic quickly so we’re going to save the configuration and we will then go ahead and save this article and if we come back to the home page click on this RSS feed you’ll notice that there’s this link to test article and you notice that it’s all … the special characters or the less than and greater than signs and signs are broken out but it has this relative link here and this can cause problems for the RSS readers and anything that may import your articles or posts.

So we’re going to go ahead and turn this back on, save this and now as I refresh you’ll notice now it has the entire path. So it converts that relative path to an absolute path, you’ll notice if you come in here it’s still set as a relative path here but this input format and this pathologic module will convert that to the absolute path when it goes to an RSS feed or anything like that to make sure you’re in good hands and your links and images will not be broken anymore.

So that’s it; Pathologic, very simple module, useful though so go ahead and give it a try especially if you have problems similar to the one that I had and let me know what you think. That’s it for this time on the Daily Dose of Drupal, we’ll be back again tomorrow, as always; follow me on Twitter @smthomas3 and please sign up for the Code Karate newsletter if you haven’t already. Thanks for watching.

5 Secrets to Becoming a Drupal 7 Ninja

Post new comment