I thought I had solved the vexed problem of using taxonomy for a hierarchical site with nice breadcrumbs, nav menus etc., using a combination of taxonomy_context, pathauto and manually built menus pointing to taxo terms, but apparently Drupal will have the last laugh.

To get the breadcrumbs right, I used a parent term for each vocabulary and aliased this term to a page that is a kind of index page for that section. But, to get the nodes for all child terms on this page, I built the urls manually. For example, if a news section has the parent term 'News' (tid10) and child terms 'Announcements' (tid11) and 'Press Releases' (tid12), I put the following in the url alias:

system path: taxonomy/term/10/11+12
alias : news

The problem

1.) When I tag a story with the parent term of a vocabulary (for example, news) that has been aliased and has manually built urls (taxonomy/term/10/11+12), the category links in the teaser sections and the term names in the breadcrumbs display the original term id (taxonomy/term/10) and not the alias name.
2.) If I run a bulk update using pathauto, I get an extra alias called 'news-0', pointing to the parent terms (taxonomy/term/10), but this is obviously not the solution
3.) I can't avoid manually building the sub-terms into the system path because Drupal does not automatically list on the parent term page the nodes tagged with the child terms of a vocabulary.
4.) I can't avoid using a parent term for each vocabulary as tax_context does not give proper breadcrumbs otherwise.

This has become a show stopper as I was about to turn over the work to the client for a review.

Please, I would appreciate any suggestions.

Comments

Jaza’s picture

Your taxonomy path looks very strange to me, Ram. Are you aware that taxonomy paths take the following form:

taxonomy/term/[tids]/[depth]/[type]

Where:

  • tids is either one term, or multiple terms separated by commas (for AND) or by +'s (for OR)
  • depth is either 0 (default), a positive number for x levels of child terms, or 'all' for infinite levels of child terms
  • type is either 'page' (default) or 'feed' (for RSS)

Why do you have a depth of 11+12? This will give you either a depth of 23, or some kind of error (error being most likely). But it certainly won't give you a listing of terms 11 and 12!

It sounds like, if you want nodes in terms 10, 11, and 12 to be displaying on one page, you should be using this path:

taxonomy/term/10+11+12

Of course, this will probably give you ugly breadcrumbs and path aliases, but it will at least display the right page!

PS: the long-awaited category module is well on its way, will be released very soon, and will make exactly this kind of problem dead simple to solve. Will post an update once I've made further progress.

Jeremy Epstein - GreenAsh

Jeremy Epstein - GreenAsh

venkat-rk’s picture

Thanks, Jaza. I don't mind admitting that I didn't know the proper taxonomy paths. I was a bit cavalier and did this from my memory on a production site (despite setting up a test site). So, two bad practices and I only have myself to blame.

I will try out your suggestions and see how it goes. I was able to temporarily solved the problem by tagging the node with the child term instead of the parent term. This solved the problem (because I had set the pathauto pattern to [catpath], but the breadcrumbs built by taxonomy_context still show the taxonomy term url and not the pathauto aliased one.

And, it's great to know that the category module is on its way!

venkat-rk’s picture

Of course, this will probably give you ugly breadcrumbs and path aliases, but it will at least display the right page!

Well, it certainly gives ugly titles! Combining taxonomy terms in this way pulls up all the term names and dumps them together (comma separated, though) as the title of the page.

Budda's nice taxonomy_vocabulary module avoids this problem and builds the combined url automatically, but I lose the nice breadcrumbs that only come when there is a parent term in a vocab.

More reasons to welcome your category module;-)

bonobo’s picture

but I just came across the node queue module:

http://drupal.org/node/38802

This probably won't help with the breadcrumbs, but it would help to group posts.

Cheers,

bonobo

-------
http://www.funnymonkey.com
Tools for Teachers

bonobo’s picture

Long URL, good article, from Nick Lewis.

Hope this helps.

Cheers,

Bill

-------
http://www.funnymonkey.com
Tools for Teachers

merlinofchaos’s picture

Let me know if Node Queue turns out to be useful to you; I'm not sure it is in the context above, but I'm not fully envisioning what it is you're trying to do, either.

If it does turn out to be useful, though, I can take a stab at some code that'll do your breadcrumb.

-- Merlin

[Point the finger: Assign Blame!]
[Read my writing: ehalseymiles.com]

-- Merlin

[Read my writing: ehalseymiles.com]
[Read my Coding blog: Angry Donuts]

venkat-rk’s picture

Thank you, Bill and Merlin. I will certainly try out the node queue module, although its description doesn't sound like it will fit my situation.

And, thanks for reminding me about the Nick Lewis article. I have it bookmarked since some time, but I am trying to push the default install and contrib modules to their limits to get a hieararchical site structure, appropriate nav menus that reflect this structure and good breadcrumbs. I am nearly there, but for the breadcrumbs showing the term url instead of the term name. For example, if I have a structure like Home>>Resources>>Trainers, the breadcrumbs show fine, but the link 'Resources' points to 'taxonomy/term/tid' instead of the name of the term, 'Resources'.

Edit: I meant that the term 'Resources' shows up correctly in the breadcrumbs but points to the taxonomy term id although I have aliased it with pathauto.

merlinofchaos’s picture

Oh that's very odd. This sounds like it may be a bug in taxonomy context. It's not something I've ever looked at, so I'm not sure about it.

-- Merlin

[Point the finger: Assign Blame!]
[Read my writing: ehalseymiles.com]

-- Merlin

[Read my writing: ehalseymiles.com]
[Read my Coding blog: Angry Donuts]

venkat-rk’s picture

Strangely, this syntax works perfectly on my site:
taxonomy/term/10/11+12

It gives the same results as:
taxonomy/term/10+11+12

Term 10 is the parent term in this vocab.

Jaza’s picture

Must be showing all the content in term 10, and all the content in child terms to a depth of 23 (which includes terms 11 and 12). Cool!

Jeremy Epstein - GreenAsh

Jeremy Epstein - GreenAsh

Nick Lewis’s picture

Instead of using terms as the highest level, ('ve gotten into the habit of using a vocab as the highest level. Bread crumbs, and the "drilling down" effect work perfectly with this method. The only downside is that you'll loose your pathauto. However, I've found that google doesn't care and always instead records the pathauto version. Moreover, the chief function is to help users browse -- path autos really only matter for search results (in my opinion).

I quickly wrote a blog entry on how to do this step by step:
http://nicklewis.smartcampaigns.com/a-taxonomy-menu-that-goes-to-11

So its a 90 percent solution, and that requires no extra code to to implement (besides installing taxonomy_menu module). Best of luck. Go through me' blogs Browse block to see it in full action.

--
"I'm not concerned about all hell breaking loose, but that a PART of hell will break loose... it'll be much harder to detect." - George Carlin

--
"I'm not concerned about all hell breaking loose, but that a PART of hell will break loose... it'll be much harder to detect." - George Carlin
--
Personal: http://www.nicklewis.org
Work: http://www.zivtech.com

venkat-rk’s picture

Thanks.

I did read the taxonomy_menu tutorial and left a comment there about the breadcrumbs- I am very picky about them. I will try it out without the parent terms and see if I still get breadcrumbs with your method of using taxo_menu module.

By the way, great tutorials. Your short post on Drupal CVS has convinced me enough to try it out.