Only sometimes does the [termpath-raw] under "Automated alias settings" create the proper alias.
For one category it works fine like: /term1/term2/term3/node-title-here
For the rest it only shows the top term like: /term1/node-title-here

When you use "Multiple select" in "vocabulary -> setting" and select only the child term then the url alias works. So the issue seems to be with selecting multiple terms.

Comments

Drupal9.9’s picture

These bug reports with several comments seen to be talking about something similar.
http://drupal.org/node/217467
http://drupal.org/node/506558
http://drupal.org/node/484770

I can report this for version 6x-1.1 as well. If multi-select is turn on for the vocabulary, and you select more than one term within the parent vocabulary, pathauto appears to work %50 of the time. It ignores or forgets to use the [termpath-raw] token and only chooses the parent vocabulary.

The issue seems to be with multi-selected terms and perhaps the weight applied to child and parent terms.

Drupal9.9’s picture

After testing it out I found the issue is indeed to do with the weight applied to parent and child terms. You can work around it by giving parent terms heavier weight than child terms but is causes extreme confusion when you have lots of vocubularies and terms and choose to multi-select between both vocab and terms when creating a new node. This is most defenately not a long term or stable solution.

gregarios’s picture

I am also having this problem. I have a single hierarchy vocabulary with 2 levels of terms. I can get the paths to be created correctly for most of the terms and child-terms, but only for sets that aren't near the top of the list on the Term hierarchy organization page. Very frustrating. I have several duplicate child terms that have different parent terms, so the workaround listed above will not work for me, because I cannot tell on node creation which parent the child terms are under.

Is there any more information you wish me to check to give you more information so I can help? I'm anxious to see this fixed.

UPDATE:

Ok, the workaround for this, for me, was to edit each of my PARENT terms, starting at the top, and sequentially make their weights 100, 101, 102...
Anyone else using this procedure is advised to look in your database in the 'term_data' table and find the heaviest weighted term. Take that number, add 100 to it, then start with that number to modify your parent term weights, in the Taxonomy settings in Drupal, sequentially.

dave reid’s picture

Status: Active » Fixed

Trick is you can only select a single term to reliably make termpath work. There are several other fixed issues in the queue that had this same problem when a node has more than one term in a hierarchy selected.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jrstmartin’s picture

Version: 6.x-1.1 » 6.x-2.0-rc2
Component: Miscellaneous » Tokens
Status: Closed (fixed) » Active

@Dave Reid

Trick is you can only select a single term to reliably make termpath work.

For most that is not the desired behavior. When I make a post to "Physics", which is a child term of "Natural Science", I expect the node to be part of both Physics and Natural Science. So selecting just Physics, in order to get the Pathauto URL to output the desired URL of "domain.com/natural-science/physics/node-title", would only make the node part of Physics and not Natural Science.

The 2 contradict each other IMO.

Current workarounds:

  1. Adjust the weights of any parent taxonomy terms to be heavier than the children. This is not feasible if a lot of taxonomy is being created on the fly at node creation time.
  2. Use Hierarchical Select's [save-lineage-termpath]. The downfall of using that is when unpublishing/publishing a node, or similar operations besides node/edit, [save-lineage-termpath] is ignored and URLs get changed with undesired results, just the [title] is used instead of [save-lineage-termpath]/[title].

Can't win! :)

dave reid’s picture

I think you misunderstand, in that case if your node is associated with the 'Physics' term *only*, then [termpath-raw] will be natural-science/physics. The problem happens when you associated a node with two or more terms - Pathauto basically guesses at which one to use.

jrstmartin’s picture

No I understand. I'm just terrible at explaining things :). What I'm trying to say is that I never select a child term without also selecting its parent term, so there's always more than 1 selected when there's hierarchy. I think this is quite natural in regard to taxonomy hierarchy in general, for example if a node is posted in Physics it's also posted in Natural Science, otherwise it's not really a hierarchy. I know Drupal lets you select just one term in the hierarchy, and maybe that's how we have arrived at this bug. (Forcing parent selection can be done with Hierarchical Select.)

I guess the root problem here is how taxonomy works in core. I think the default behavior should be that parents are automatically selected when their children are selected. Thanks for listening! :D

splash112’s picture

A solution could be to use 2 Content Taxonomy fields:
1st; main term with a required max 1 term for the path alias
2nd; extra terms with unlimited terms

Using it now with a patch from this issue: #420240: "termpath" token support for hierarchical vocabularies for use with Pathauto and am so far happy with it. Now just need to find out how to get multiple Taxonomy breadcrumbs on my node pages.

mably’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.