Path Filter Module - I wish I had found it sooner

Located in:

Drupal is known to have a pretty steep learning curve. There's a lot to it and it's hard to get your head around just how it works. "No problem", you think, "I'll just learn as I go." Well, I wish it were that easy. The fact is, in the rush to get things built you might employ a suboptimal solution and later discover there was a great module that would have done things nicely for you.

Number one with a bullet...point

  • Internal linking is messy and hard to maintain but it's necessary
  • What's the problem? Just link using regular HTML
  • Path Filter is easy to understand and teach to content contributors

Not every site has user-generated content

One of the great things about Drupal is that you can build a community site right out-of-the-box. However, not every site is a community site. The site I currently work on may want to add community elements later (and that's one of the reasons I chose Drupal), but for now, it's an information website. Thousands of articles with lots of links between articles. It's laborious and messy, but if article A mentions travel restrictions and it refers to article B where those restrictions are listed, then it makes sense to link from A to B.

Why not just do <a href="?q=node/68"...

Well, that's what I did but later when I turned on clean URL's on the production site, a lot of those links got screwed up. (and some image paths got broken too) In essence, if a page URL before was something like with clean URL's enabled, it would be That's all fine and dandy but now any "non-clean" links embedded in that page will result in a link like this: (assuming the embedded link was ?q=node/68)

See what happened? The ?q=node/68 link was simply appended to the clean URL ( of the originating page. The funny thing is, those links still worked but it's not the way it's supposed to be.

Path Filter to the rescue

The path filter syntax is very simple: <a href="internal:node/68">Link to node 68</a>. Just use internal: and Drupal knows you want to link internally and the path filter module will take care of whether it should be done with a query string ( or cleanly ( or with some other path ( Assuming your content contributors know some HTML, it's not hard to tell them to use the path filter syntax for internal linking.

In essence, don't do this: <a href="?q=node/68">, do this: <a href="">. Just don't forget to enable the filter for your site's input filters! (admin/settings/filters)

P.S. Version 2.0 of path filter is supposed to do the same thing for default file locations using files:name_of_file.pdf.

Average: 1 (3 votes)
Your rating: None

Social mediatize it!

Twitter Twitter Facebook Facebook     
How about that! I'm a Drupal association member.

Attention IE user!

It turns out you are using an outdated browser and my site might look a bit weird for you. (images are off colour, text gets cut off, layout is wacky) This is because your browser does not implement web standards. Please consider an upgrade.

Alternatively, you can try other browsers like Google Chrome, Mozilla Firefox, Opera or Apple's Safari. Every web developer on the planet will thank you! (and that's not really an exaggeration)

Hide this notice for the rest of your visit