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.
links1
link2

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.
link3

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.

CommentFileSizeAuthor
links3.png55.39 KBnikolaat
links2.png57.01 KBnikolaat
links1.png56.77 KBnikolaat

Comments

NikolaAt created an issue. See original summary.

berdir’s picture

Version: 8.x-1.4 » 8.x-1.x-dev
Category: Bug report » Feature request
Priority: Major » Normal

I 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.

weseze’s picture

I 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?

fengtan’s picture