Skip to main content

Configure the Path and Pathauto modules

April 29, 2010 by Steve

Path and Pathauto work hand in hand to make your site easier to navigate. Path is the module that allows you to set up URL Aliases for your content. This page would normally have the url sitename/node/24, but with Path I can rename it to whatever I want. And Pathauto is the module that automates that process so that it happens when I save the content, rather than having to go edit it later.

Go to the Site Building > URL Aliases page. As you add content, this list view will show the aliases applied to your different pages. Right now it is empty, since we haven't posted any content.

Select the "Automated alias settings" tab. There are several sections. Take a look at the General settings - there are a lot of them, but most shouldn't need changing. Since I wanted my URL to include the phrase "build-this-site", I removed the word "this" from the list of Strings to Remove.

I made no changes under the Punctuation settings.

I wanted to have a fairly simple URL structure, one that would be easy for humans to read. I want the URL to be made of the section name and the title of the node, as you can see above. I wanted the weblinks handled differently, to use the word "links" instead of the category. So I changed the default setup for Nodes and Taxonomy as follows.

Under "Node path settings", you can see that the default path for all nodes is "content/[title-raw]". The square brackets represent a Token, a piece of information that Drupal will pull up as needed. The token [title-raw] pulls up the title of the node. So by default, every node URL has the word content and then the name of the article. I replaced the word "content" with another token, [termalias]. That gives the aliased path to the taxonomy term directory, which I thought would keep everything tidy. That's the default, but for links I did want a constant name, so I changed the links alias to be "links/[title-raw]".

For the Taxonomy term settings, I also want to change the defaults. The default setting for everything is "category/[vocab-raw]/[catpath-raw]". That means always use the word "category", followed by the taxonomy group name (like Sections or Topics), followed by the name of the term. Using [catpath-raw] rather than [cat-raw] means that if you have categories and sub-categories and sub-sub-categories, that the whole path will be listed, rather than just one term.

I want to take out the "category/[vocab-raw]" parts because I don't think that adds much useful information in the URL. I have mine set to "[catpath-raw]" for all Taxonomy URLs. Also, be sure to click the checkbox for "Bulk generate aliases for terms that are not aliased." This will add aliases for your taxonomy terms all at once.

Don't forget to save your changes when you're done setting things up.

To get the list of available tokens, see my notes on setting up the Token module.

Finally, neither Path nor Pathauto have any permissions that need configuring for anonymous users.

@stevew99999

  • @rosamundlannin I make regular chili but use that veggie crumble meat substitute stuff. 5 years 3 weeks ago
  • @Snarky_Geek Since I was awake at 4:30 this morning, and finally just gave up and went to work around 5:45, I feel your pain. 5 years 4 weeks ago
  • One of the Chicago office dogs really wants to play this morning @the_nerdery, keeps bringing toys over to try to start something. 5 years 12 weeks ago

Premium Drupal Themes by Adaptivethemes