This may have been covered elsewhere on this site, but I had no luck with searching. I've searched through the results, and tried to narrow my search as much as possible, but had a hard time finding info on this particular situation.

I have clean URLs working fine, and I get such URLs as "/node/2432" and "/taxonomy/term/3" and all that, but what I would like to do is have URLs that are more discriptive and even "cleaner".

For example, if I was running a site about the united states, and had news about each state, and then news about certain cities within those states, I would like to see URLs in the form:

"/michigan/detroit" to get all the detroit news and "/indiana" would give me all the indiana news.

Are these kind of URLs possible with the latest release of Drupal? Instead of seeing "/taxonomy/term" I'd actually like it to be what the particular taxonomy and term are.

Thanks in advance for the help!

Comments

Jaza’s picture

Check out my hierarchical URL aliasing patch, I'm guessing this is exactly what you're looking for. The patch will construct aliases based on the taxonomy hierarchy that your node is in, e.g. if your node is categorised under "california -> sacramento", then the URL would be "/california/sacramento/article_about_sacramento".

This patch is for 4.5.x (but may work with 4.6RC - don't know!). This functionality is not available in core or contrib for any Drupal version as yet. I will be developing a module to do this in the near future, but it's not out yet.

Jeremy Epstein - GreenAsh

Jeremy Epstein - GreenAsh

stevensj2’s picture

Thanks for the reply!

That's a pretty cool path you wrote - and I agree that this should definitely be core functionality.

But as you said, there does arrive the problem of having paths ending with the same.

Considering my site will have several paths ending in "/news" I don't think this will work as I had hoped.

Thanks again!

I'll be watching for future releases of Drupal to see if this ever becomes part of it out of the box.

Something such as "/your_category/your_sub-category/#" where "#" was a unique content ID # assigned by Drupal would be perfect. it would still be very neat and clean, while avoiding the problem of having paths ending the same.

Steven’s picture

Note that you can already specify freeform paths in core with path.module. It seems you missed this. All this patch does is automate it.

--
If you have a problem, please search before posting a question.

ramdak5000@www.drupal.org’s picture

Well, if I am not mistaken, the patch gives you three things the path.module in core doesn't:

1.) hierarchical aliasing based on a defined taxonomy
2.) breadcrumb navigation based on taxonomy hierarchy
3.) cross-vocabulary taxonomy hierarchies

Jaza’s picture

"...you can already specify freeform paths in core with path.module... All this patch does is automate it."

Automated aliasing is a huge step up from path.module's freeform path entry. Say you have a category "news -> music -> jazz & blues", and you want to add 100 articles to this category. Typing aliases like this:

"news/music/jazz_blues/article1"
"news/music/jazz_blues/article2"
...
"news/music/jazz_blues/article100"

is just a tiny little bit more annoying than typing them like this:

"article1"
"article2"
...
"article100"

wouldn't you say?

Not to mention the fact that with my patch, all you have to type in is "article1", and the aliases:

"article1"
"news/music/jazz_blues/article1"
"news/article1"
"music/jazz_blues/article1"
(etc...)

will all work (although only the full one will actually be generated for links). Whereas if you type in the alias "news/music/jazz_blues/article1" without my patch, then only that exact path will resolve.

Jeremy Epstein - GreenAsh

Jeremy Epstein - GreenAsh

kbahey’s picture

The excellent pathauto module does the node part of this automatically.

You can configure it to automatically generate aliases for nodes such as category/year/month/day/title-of-node-goes-here

You can use many variations, as it is highly configurable.

The only part it is missing is that if it can do taxonomy terms aliases (in the taxonomy URLs and not the node URLs).

I use pathauto and it takes care of nodes. The terms, I still have to do manually. Since this is infrequent, it is not a real hinderance.
--
Consulting: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

naudefj’s picture

I need this as well. Hope it will be implemented in CVS...

kbahey’s picture

This has been done for a while. It does taxonomy now, as I had wished it to do.

--
Drupal development and customization: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba