If the pathauto module is enabled during a content import, the menu items created for that content do not work. I don't know why, at this point, but here are my observations.
pathauto on
Node created by import:
chinese-medicine-diagnosis/pulse
Direct link works. menu items are created correctly, but the links do not work.
Menu path shows in edit as:
chinese-medicine-diagnosis/pulse
URL alias looks like:
chinese_medicine_diagnosis/pulse node/310
The node/310 path works.
Turn pathauto off
Menu link still does not work.
Delete node, menu items, and URL alias.
Re-import same content.
Node created by import:
chinese-medicine-diagnosis/pulse
Menu path shows in edit as:
chinese-medicine-diagnosis/pulse
URL alias looks like:
chinese-medicine-diagnosis/pulse node/311
The node/311 path works.
pathauto on again
The menu link for "pulse" continues to work.
Import another file. Node created by import
chinese_medicine_diagnosis/diagnosis_by_observation
Direct link works. Menu items are created correctly, but the links do not work.
Comments
Comment #1
dman commentedThe automatic alias creation is an alternative to pathauto. It seems the algorithm for title hashing is different - using _ instead of - . I'm guessing that both methods are trying to make the alias and conflicting.
node is created, initially with no path.
pathauto may do its thing here.
Due to me not knowing what the new nid was going to be, the naviagtion gets added in a scond pass.
my_path is created, and assigned to the node
menu item is created, and linked to my_path (? or not)
I just had a look at pathauto. It will always REPLACE existing aliases if being invoked on a node insert - it doesn't expect an alias to be already set when the node is new. I wonder if that conflicts with normal aliasing?
I think I can see how this can be fixed using drupal_get_placeholders() - it's a new one to me. It may prevent my current need to do things in two phases.
Have to see...
Comment #2
dman commentedFollowing some investigations, I was unable to replicate this problem.
Did you have the pathauto settings to "Create a new alias in addition to the old alias" or "do nothing"?
Both those settings seemed to give me the expected results. With the import html settings at default (create legacy aliases, create tidy aliases) and the pathauto also creating an alias from the title, I ended up with 3 altogether
and the menu config page was linked (as expected) to "imported/scene/webcam"
ALTHOUGH as you may see, the html produced actually used the pathauto whats_happening_right_now link when rendering the menu.
- when there are multiple aliases, I'm not sure which one gets picked to get displayed in the code.
Anyway. I can't really replicate, can you describe any changes you made to pathauto configs? you are using '-' not '_' as the separator?
Comment #3
L0rne commentedhere are my relevant pathauto settings:
I can see the potential for "Create a new alias, replacing the old one" to cause problems in this situation.
changed to "Create a new alias in addition to the old alias"
Now the newly created menu links work when the node is imported with pathauto on.
And I get two URL aliases:
So this seems to have solved my problem. Next time I'll look through my settings more carefully!
Thanks for your help.
Comment #4
dman commentedYeah, looks like the biggest problem was pathauto destroying my preferred aliases.
I didn't really allow for the idea that paths would be deliberately deleted as soon as I made the menu!
I COULD have made the menu links go directly to node/# links, but I preferred to chain the process:
Menu item links to alias, alias links to node. Just feels better to me.
So the '-' are coming from your dir/file names? OK.
The auto paths from import are pretty much identical with [menupath] anyway, so there's not much point in having both happening I'd have thought. Except the -_ conversion it's doing for you :-/
Ah well. All pretty understandable, I guess.
Comment #5
dman commentedI'll be adding the option to link the auto-generated menu items to nid not alias soon. 4.7 adding pathauto to core makes this a non-issue.