Drupal Path (URL Aliasing) - Getting it working with XML Sitemap(gsitemap)

So another great bit of advice that I received from Mike at OpenConcept Consulting was to use the Path and Path Auto Module.

So I did just that. From now on, you shouldn't see any /blog/node/## urls on this site. After researching into this further, human readable urls improve your page ranking. Just what I need.

After enabling the Path module which comes default with Drupal 5, I renamed a few of the urls for the main menu. This works great. I created the blog post regarding My First Facebook Birthday, and gave it the url alias 'my-first-facebook-birthday'. Then I headed over to the XML sitemap that the XML Sitemap Module creates and I noticed that it didn't use the alias, but was still using /blog/node/39. I was a little bummed.

So, as normal instincts would dictate, I Googled for a solution. I found the solution in Doesn't use aliases created by Pathauto. It's an extremely long page so I'll summarize it below.

The reason why XML Sitemap doesn't use the alias is because when a node is submitted a series of modules update themselves. (eg, the Path Module, XML Sitemap module, Tagadelic Module..etc) They update themselves ordered by weight, then by name. Since all modules have a default weight of 0, they update by name. The XML Sitemap (the  name stored in the database is 'gsitemap') comes before the 'path' module alphabetically. Thus the XML Sitemap gets updated before the alias has a chance to get written.

You can solve this issue in a few different ways.

  • Use the Module Weight module to change weight of the XML Sitemap module to 1.
  • You could go straight into your Drupal database, go to the 'system' table, find the record with the name 'gsitemap', and change its weight to 1.
  • You could run a query on your database.
    UPDATE system SET weight = 1 WHERE name = "gsitemap"
  • There are a couple of patches in the original thread.. you could try those.

If you are not comfortable tinkering around inside a database, the easiest route to go would be to install the Module Weight module. 

If none of these solutions solve the problem, then read the whole thread with all the comments, and one of the other suggested solutions is bound to work for you.

Personally, I can't wait to

Personally, I can't wait to get my hands on a Nikon D-90. Now that's what I'm talking about!

Post new comment

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