menu link like [node:menu-link:parent:url:path] not working

Created on 10 February 2021, almost 4 years ago
Updated 15 August 2024, 4 months ago

Problem/Motivation

I'm having a strange problem where pathauto patterns aren't generating parent menu items. I've got a url alias pattern set up [node:menu-link:parent:url:path]/[node:title] and Drupal 9.1.4 won't add the parent path to the url alias. When I set it up on a fresh Drupal 9 site, it works as expected.

The reason I put the issue here and not in the pathauto issue queue is that I can put placeholders in the pathauto pattern such as /pre/[node:menu-link:parent:url:path]/post/[node:title] and the placeholders show up fine. Also when I look in the "Browse available tokens" I don't see menu link option at all which seems very suspicious:

On my test site, you see the token appearing:

Steps to reproduce

1. setup pathauto pattern [node:menu-link:parent:url:path]/[node:title]
2. create a node and add it to main menu (e.g. title: page1)
3. create another node and add it as a child to the menu e.g. page2
4. You expect page2 url alias be page1/page2 but instead the url alias is page2

I'm glad to go hunting for the culprit so any suggestions would be welcome. I'll be stepping thru token code and see if I can find anything. I know it is somewhat unrelated, but I tried the patch at https://www.drupal.org/files/issues/2021-01-14/pathauto-update_child_ali... β†’ but that had no effect.

πŸ› Bug report
Status

Active

Version

1.9

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States selwynpolit

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¦πŸ‡ΊAustralia cb Sydney

    This is an old issue but I'm getting this with Drupal 9.5.9 at the moment using the same token [node:menu-link:parent:url:path] - it simply will not show parent url path - i only ever get the child node in the path.

    I'm hoping its an easy fix. :)

  • First commit to issue fork.
  • πŸ‡ΊπŸ‡ΈUnited States ed2908

    I'm not seeing this token in the list of available tokens using 8.x-1.15 in Drupal 10.3.2

    When I enter [node:menu-link:parent:url:path] into my pattern, it's simply ignored.

Production build 0.71.5 2024