I'm using pattern to use for node alias.
The pattern I am using for certain CT is: [node:menu-link:parents:join-path]/[node:title].
It set all menu parent items, for my node in url and finally the node title.
When I edit node from edit form and select the parent, url is created correctly.
The problem came when I change the menu structure from main navigation. For example I move my node called level 3 from one parent to another. From drag and drop I change parents as you can see from 2 pictures.


I am expecting my level 3 node to change its url structure to use the parent item. Instead the url is the old one: /level-1/level-2/level-3.
Expected: /level-1/level-2-2/level-3
To take affect of the changes the node should be pre-saved which is problem.
The issue came in one more situation. When I change for example parent link - level 1. picture below.

I expect my children menu items to change their url with updated parent url name. Unfortunately I should pre-save all my children nodes to be able to see the changes.
| Comment | File | Size | Author |
|---|---|---|---|
| links3.png | 55.39 KB | nikolaat | |
| links2.png | 57.01 KB | nikolaat | |
| links1.png | 56.77 KB | nikolaat |
Comments
Comment #2
berdirI don't consider that a bug but a feature that would be hard to implement generically.
There is a practically unlimited possibility of things that could influence massive amounts of aliases, menu trees, term hierarchy, things like domain/og and so on.
Pathauto includes a bulk update to re-generate all aliases of a certain node type as a workaround.
Comment #3
weseze commentedI also encountered this and expected it to work.
When debugging this I noticed that path alias update logic is called for all menu items that are changed. But the alias it generates seem to be based on the old/previous data instead of the changes saved in the menu.
Also, after applying the patch from #3016532: Pathauto token for node menu hierarchy not working after updating parent node I noticed in my debugging that all "nested" menu links were also passing through the alias update logic.
I tried changing the pathauto module weight to something higher up then menu_link_content, hoping this would give me the updated alias, but that gave the same result.
Seems to me that if we could figure out why PathautoGenerator::createEntityAlias() returns an alias based on the previous menu link, we will have actually solved this issue?
Comment #4
sylvain lavielle commentedMaybe this could help :
https://www.drupal.org/project/pathauto/issues/3016532#comment-13894750
https://www.drupal.org/project/drupal/issues/3181070#comment-13894884
Comment #5
fengtanWe are using a similar pathauto pattern in https://www.drupal.org/project/alias_hierarchy and resorted to update aliases on cron (based on #3016532: Pathauto token for node menu hierarchy not working after updating parent node): https://git.drupalcode.org/project/alias_hierarchy/-/blob/1.0.x/alias_hi...