Closed (fixed)
Project:
Pathauto
Version:
5.x-2.1
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
19 Apr 2008 at 17:31 UTC
Updated:
10 Sep 2008 at 12:12 UTC
The default path pattern for nodes is:
[termpath-raw]/[title-raw]
When i create a new node, only the [title-raw] seems to be taken into consideration. The category path which the node belongs to is not reflected in the path.
However, when i edit the node and save the node - then the [termpath-raw] is taken into consideration, and the full category hierarchy which the node belongs to is also reflected in the URL.
Any idea what this is caused by? Why is the node path only being generated correctly when i update a node, but never when i create it?
Comments
Comment #1
gregglesDid you upgrade from a previous version of Pathauto? If so, did you run update.php? I think this might be a problem with the "weight" of the Pathauto module which you can confirm by looking in your database at the system table for the "weight" column. It should be 1 for the line with the "name" of Pathauto.
Comment #2
gregglesTwo weeks without response -> closing.
Comment #3
sbrattla commentedHi,
Sorry for a late reply on this one. I did a clean install of Drupal 5.7, and i am using Pathauto 5.x-2.1.
Please find details for the module below. The weight of the module is 1. Any ideas would very much be welcome.
[filename] => modules/pathauto/pathauto.module
[name] => pathauto
[type] => module
[description] => Provides a mechanism for modules to automatically generate aliases for the content they manage.
[status] => 1
[throttle] => 0
[bootstrap] => 0
[schema_version] => 6
[weight] => 1
Comment #4
gregglesInterestingly enough, in #257746: Node path setting [termpath-raw] requires an edit to properly save path they had the same problem but it was after an upgrade and once they visited update.php it worked fine. I'm still not exactly sure what the problem is in this instance but at least now we have more information.
Comment #5
giorgio79 commentedI think I am getting this as well.
Am I right to assume that termpath = catpath? I have not seen any explanations of what exactly is the difference between termpath and catpath.
Because for me as well, the termpath is empty.
PS: This turned out to be a vocab weight issue. I had multiple vocabularies, and it was using the one that was empty :)
Comment #6
gregglesTermpath and Catpath are similar but are intended to be used in different contexts. Catpath is for the "Category path settings" and termpath is for the "Node path settings". When you view the admin/settings/pathauto page do you get any red warnings at the top of the page?
Comment #7
sbrattla commentedThanks for the answers. I have tried to find the update.php, but i can't really find that file anywhere?
Comment #8
sbrattla commentedUpdate: i did run the update.php, but it did not help. The drupal and pathauto are also fresh installations (no upgrade from earlier database), so it should not really be the cause. Any other suggestions are very much welcomed.
Comment #9
greggles@giorgio79 - please don't edit your comments. It makes for a very confusing flow and is harder to notice (I get emails about my issues and never get emails if someone edits a comment).
@sbrattla - is your lowest weight vocabulary term populated when you have this problem?
If that is the cause perhaps we can change this issue to be about using the next lowest weight vocabularly? OR, it could be that we warn users if the lowest weight vocabs are not "required".
Comment #10
greggles@sbrattla - I just tried this with a simple vocabulary (a forum, really) with
Vocabulary:
Container
- Forum
node title: "asdf"
forum node pattern: [termpath-raw][title-raw]
node url when the node is created: "container/forum/asdf"
Which is exactly as expected. So I'm marking this as needs more info. Can you provide some more details about your vocabulary? Sorry this is taking us so long and thanks for sticking with it.
Comment #11
sbrattla commentedThanks for all the input. Here are some more details about my categories:
I have 1 top vocabulary called 'category', and several terms under that category
Category
-Study Groups
-- 1. Elements of Costume
---- Blog
-- 2. Material and Technique
---- Blog
-- 3. Quality of Fibre
---- Blog
-- 4. Color and Dating
---- Blog
-- 5. Exhibition
---- Blog
So, when posting a new article in one for instance the elements of costume blog, the path should be [domain]/study-groups/1-elements-of-custume/blog/[article title]
I am not quite sure what you mean when you ask wether the lowest weight vocabulary term is populated. I have one (and only one) vocabulary term, which holds all my terms. So, i guess it is populated?
Thank you very much for helping me on this. I'd be more than happy to provide more details from my configuration.
Could it by the way be that any other modules interfere with pathauto (could anything disturb how the modules "hooks" into the system)?
Comment #12
gregglesYes, the comment about whether or not it is populated is that sometimes vocabularies are optional and so if a vocabulary is empty then, of course, there is no termpath to generate. In your case since you only have one taxonomy and you are selecting a term from that vocabulary before you submit I agree that it is populated.
I'm kind of stuck for ideas right now. Is the "Blog" term the same single term which has multiple parents? Is this vocabulary a "multiple hierarchy" vocabulary?
I guess one thing that would help is if you could create a brand new site and only enable pathauto/token. Then create a simple vocabulary (no hierarchy) and create a node using [termpath-raw]/[title-raw] as the pattern. Then change it to be a hierarchy and see if that starts causing the problem. Keep going until you find the total set of steps to cause the problem.
Comment #13
sbrattla commentedI've done some more testing on this, and at first glance it seems like i have managed to fix the problem.
Apparently, the problem was to be found in the system table. The taxonomy module, which assigns terms to a node (and forms the basis for the path generation which Pathauto does) had the weight 15. The pathauto term had the weight 1. This resulted in pathauto being called by drupal before the taxonomy module, which made everything to happen in the wrong order.
So, i set pathauto module's weight to 20. That way, it gets called by drupal after the taxonomy module (which does preparatory work for pathauto).
I am not sure if the taxonomy module has 15 as its standard weight, because i've been fiddling around a little with that module in order to make it interact with a few other modules. So, most likely this is all caused by my own customisations.
However, it might be good for someone else to know...
Comment #14
gregglesAha - well, the taxonomy module (and all core modules) should generally have a weight of 0. I guess that some other module you had installed set it to be 15 which is somewhat abnormal.
Can you confirm if this was a change you made or a change made by one of your modules? To find which module it might be, you can search the code for an UPDATE query which is run against the {system} table.
Comment #15
te-brian commentedHey Guys,
I was scratching my head for a while on this same issue and I can confirm that it was the weight of the taxonomy module in relation to pathauto. I'll be sure to remember to check the system table again when modules aren't interacting as expected.
I am curious to understand why editing a node produced the correct url. I had this same behavior and am wondering what differs in the updating process versus the inserting process that makes the resultant url differ.
Comment #16
gregglesIt has to do with the way that token module gathers data. Token module expects data about the taxonomy to be in the Database. When you add a node to the database with taxonomy having a heavier weight than Pathauto (and therefore than token) the data about the taxonomy has not yet been saved to the database. When you then edit the node the data from adding the node is in the database (but not any edits). So, Pathauto picks up the data that was added during the initial submission of the node.
Comment #17
sbrattla commentedWithout being 100% sure, the module weight was most likely caused by my own customisations. I haven't installed any other modules that could have done it, but i made a couple of modules myself which i needed to do a little bit of tweaking for. So, i guess i can conclude that my own customisations was the cause.
Sorry for the time any of you should have spent on it, but hopefully this thread can be of value to someone else.
Comment #18
gregglesSounds good - thanks for responding back here.
Comment #19
belas commentedJust a follow-up confirmation on this issue, as I had nearly the same experience. Stories posted to my site were assigned only a portion of the requested path, but received the correct full path after editing.
I found that the token module had been assigned a weight of 10 (and global redirect a weight of 1500). Pathauto was set at 1, all other modules set at 0. I changed pathauto's weight to 11, and the problem went away.