www.itowler.com - Ian's Home on the web  www.itowler.com - Ian's Home on the web

  • Home
  • Blog Archive
  • Family Tree
  • Contact
  • About
Home » Blogs » Ian's blog

Token and Path Alias changes in Drupal 7

7

Ian —Mon, 02/07/2011 - 13:45

  • Drupal

I will preface this post with the following:

So this is a minor gripe in the big picture, and I am sure that it is all my fault.

When I upgraded from Drupal 6 to 7 it appears that all of my automatic URL Aliases stopped working.  What you ask is a URL alias?  When drupal creates an article, by default it gives an URL of www.mysite/node/56.  In this case that means that it was the 56th piece of content to be created on the website.  Using some of Drupals magic features (namely the Pathauto module) you can have:

www.mysite.com/node/56  -> turned into -> www.mysite.com/Blogs/2010/12/This-article

You can change the renaming patterns based on info that is already in the Drupal system.  In the example above I am using the content type (Blogs), the year the post was created (2010), the 2 digit month it was created in (12) and the title of the post (This-Article).  All of these things are already in the Drupal system, and we can use the Token module to dynamically pull the info into the process.  The process really helps in making a website seem more user friendly, and in general makes it easier to navigate.  

Before the upgrade to Drupal 7, the code for the url alias used to be :

Blogs/[yyyy]/[mm]/[title-raw]

After the upgrade, the code is now:

Blogs/[node:created:custom:Y]/[node:created:custom:m]/[node:title]

While I am glad that I figured it out, I wish there was a bigger warning that there was a change.  I am fairly sure that there was a warning somewhere, but I missed it, and as such the syntax that I was using previously did not work after the upgrade.  The Upgrade did bring a cool feature, and that is the ability to use the PHP date functions as a "custom" date token. I have taken advantage of those to grab the year and month for the path.  Some of the other patterns available in the PHP date function can be found here.

So, just a heads up, if you are upgrading your site from Drupal 6 to 7, make sure you check that you pathauto patterns are still valid.

 

  • Ian's blog

Add new comment

The content of this field is kept private and will not be shown publicly.

More information about text formats

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Blog Topics

1940 Census Advice Beer Book Review Computer Humor Computers DAR Library Debt Deep Thoughts DNA Genealogy Drupal Eagle Scout Family Family Tree Genealogy Goals Green Living Indiana Records itowler.com Keira Losing Weight Maps Miami University Money Online Genealogy PGV Pi Day Poem Random SAR Saving Money Sharing Sources Surname:Arbuckle Surname:Cox Surname:Hoffman Surname:Spaugh / Spach Surname:Toler Surname:Towler Technology Update Website Work World News

User login

  • Request new password
  • Home
  • Blog Archive
  • Family Tree
  • Contact
  • About