Hi,

I'm trying to use the menu items of parents as the automatically generated path by using [node:menu-link:parents:join:/]/[node:title].

I have removed forward slashes from being stripped in the punctuation settings.

The issue I'm having is that my top level item has its path set manually, rather than being generated by pathauto.

If this page's title is foo, but it's path is set to bar, when I add a child of this page, the path is /foo/baz, not /bar/baz as expected.

Is this intentional? It seems that pathauto is figuring out what the path *would* be if it were automatically generated, rather than what it actually is.

Thanks.

Comments

kiwimind’s picture

Version: 7.x-1.0 » 7.x-1.1

Further to this issue, this does not only apply to manually set menu paths.

I have a page that has a page title of foo, an automatically generated path of foo, but a menu title of bar. When I create a new page, baz, and use the pattern of [node:menu-link:parents:join:/]/[node:title], I would expect to see the url for baz to be /foo/baz.

What's happening instead is that the path is /bar/baz, so the pattern seems to be picking up on the menu title, rather than the actual path.

Any ideas what is causing this?

caschbre’s picture

I'm experiencing the same issue and haven't been able to track down a solution.

Either we're using the wrong token and there isn't a token for parent path.
Or the token is using the wrong values (menu title vs node title).

I'm guessing it's that we simply don't have a token for parent path or parent(s) path(s).

Dave Reid’s picture

Maybe you're looking for [node:menu-link:parent:url:path] ?

caschbre’s picture

Maybe you're looking for [node:menu-link:parent:url:path] ?

That's exactly what I'm looking for and saw you mention that in another issue. Thanks!!

I went back and looked through the replacement tokens listed at admin/config/search/path/patterns and that token is not listed as a replacement option. The token does what I expect it to... so is it not being listed a separate issue?

timfletcher’s picture

Issue summary: View changes

I'm using something similar to generate my paths, with a dedicated field to capture the desired text to appear in the URL called field_slug.

I tried using [node:menu-link:parent:url:path]/[node:field_slug] on a page nested under a nolink Special Menu Item, and while this works if the parent pages have consistent URLs, it fails if the parent menu item is a nolink, e.g.

defined-url (Title):

* parent-page (My parent page)
  L nolink (My subcategory) <-- URL must be set to 'nolink' to this to be rendered as plain text
     L child-page (My child page)

This results in nolink/child-page rather than parent-page/nolink/child-page. The apparent solution to this leads back to the original issue: using [node:menu-link:parents:join:/], which results in:

my-parent-page/my-subcategory/child-page instead of
parent-page/my-subcategory/child-page.

Note that here ONLY the current node's URL is respected, everything else uses transliterated titles.

It sounds like the issue is that PathAuto uses *transliterated titles* by default when accessing the paths of nodes in node:menu-link:parents, rather than first checking for defined URLs. Alternatively, could this be an issue with Token offering the titles rather than defined URLs in the first place?

Additionally, Special Menu Items could either be updated to use transliterated menu item titles rather than the nolink OR simply use PathAuto's URL Alias patterns to strip out the 'nolink' text altogether?