Posts Tagged with “pathauto”

Drupal tip: disable Pathauto URLs for specific content types

I’ve been getting acquainted with Drupal lately because I’m using it as the CMS for a few client websites. Had to learn so much through trial and error and with so much headaches that I decided to start posting these Drupal tips to help me remember and to help some other Drupal newbies out there. So to kick off the many Drupal tips to come, I give you today’s tip on how to disable Pathauto for specific content types.

Why would you want to disable Pathauto for certain content types? Well, let’s say you have an About page (a Page content type) that you would like to title ‘About this site and the answer to life’. You write the page and then uncheck the Automatic Alias check box and give it the url of about and click Submit. Your page is published, hooray! But every time you edit the page you need to remember to uncheck the Automatic Alias check box or the URL will revert to whatever Pathauto pattern that has been assigned to the Page content type. This is very bad for client sites especially.

So, how to disable Pathauto for Page content types? The answer is blindingly simple – delete Pathauto’s default path pattern (content/[title-raw] by default). Then leave the Page content type pattern blank and fill in the patterns for the other content types that you want to have Pathauto generate URLs for. This way, Pathauto will not revert to the default pattern whenever you edit your Page content types.

Till the next tip!