Closed (fixed)
Project:
Pathauto
Version:
8.x-1.3
Component:
Tokens
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
12 Oct 2018 at 13:33 UTC
Updated:
30 Jan 2025 at 03:40 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
njim commentedI had a similar issue and was able to fix it by adding a 'safe token' on this admin interface to avoid certain types of token from being processed by the AliasCleaner. Adding 'path' to the list of safe tokens will ensure that any paths being passed as a token will not enter this sanitizing process. Looking back at the changelog, past safe tokens that were hardcoded in the module included: path|alias|url|url-brief
Alternatively, you can change the punctation settings for pathauto. Visit the administrative settings page for the pauthauto module (/admin/config/search/path/settings) and navigate to the 'Punctuation' fieldset. Change the settings for "Slashes" from "Remove" to "No Action (Do Not Replace)". Be caution that your site is ready for this setting-change as slashes brought in by text fields will cary through to the URL.
I do not know the scope of recent changes to the pathauto module; I am unsure if this is new functionality or if one of the helper classes is simply using these settings differently.
Comment #3
jnicola commentedI just started running into this myself. Never had this apply to anything else we've had before this for months, and then suddenly it's a thing.
The punctuation method above seems to work for us, but does require regenerating all aliases.
Unsure if there are any implications from all of this.
Comment #4
njim commentedI'm posting a follow up because I've received several messages on previous comment. This problem started with some changes in Pathauto 8.x-1.3 when the 'safe tokens' were moved from hardcoded references in the module to the modules 'Settings' page. This mechanism filters/replaces punctuation in tokens according to your site's settings. But some tokens, like paths and aliases, may need symbol like slashes.
The module should have prevented this issue for me
The pathauto contributors accounted for the problems that I had by including an update hook in pathauto.install. But I'm not sure why this didn't fire for me. Perhaps there was a problem with the order of operations of my updates and configuration tasks. Also not sure why 'alias' is included twice.
A manual fix is easy to implement
If you are having similar problems, the safe token patterns can be manually set on the module's settings page (/admin/config/search/path/settings). For the 'Safe Tokens' field, add the following values to match what is in the install hook:
alias, path, join-path, login-url, url, url-briefComment #5
jnicola commentedIt would appear there is more going on than meets the eye. Writing a behat test to validate that this is infact the solution, and here's what happens when I just make the slash replacement above!
What response do I get?
http://web/oh-snap/works/get-outta-here/url-alias-testing
For some reason the second bit of text after the dash is being stripped out as well?
Comment #6
njim commented@jnicola while my site is structured differently, I can reproduce the issue you are having. My solution above applies to my site, but unsure if it will work for you needs.
I suspect that the url from your group is being passed to the basic page as a token. Then tokens are filtered and altered through several settings. For my site, the "Strings to Remove" field would remove the word "this" when building url values. This feature is useful when URLs are being generated from another content field such as the node's title field and we want to remove filler words from the autogenerated path.
For my site, the page uses a
[node:field_parent:entity:url:path]token to help build the url for the child page. This exact token name is likely unique to my site, but your site may have similar logic. The pattern for the child page was created in the pathauto 'Patterns' admin interface. (/admin/config/search/path/patterns).I need to make sure that my

pathtoken does not get altered by the "Strings to Remove" logic. So I addedpathto the "Safe Tokens" field and it started to work again. I hope this helps. If not, please let us know what you find out.Comment #7
jnicola commentedIt should be noted that is is for automatic paths that are built using others automatically aliased paths. I bet this somewhat less common but not rare situation was perhaps not considered.
Any objections to updating and broadening the title?
Comment #8
websiteworkspace commented@nJim
Are you sure your example isn't a typo?
---never mind---
After some testing, your example works!
The problem is that the token list generate at {site}/admin/help/token on a D8 Drupal site does not include this construct in the list!
I even tested this with D8 Commerce 2.x products and it works with those entities as well!!
After quite a long time searching for a solution for D8 commerce products, the construct below is the solution!
The construct below even works with a hierarchy or product categories.
You can see the results of implementing the construct above, in action at the following link, whose URL was generated with the token construct above!
(what a relief!!!!!)
https://dc2xdemo.websitework.space/products/category001/category001001/c...
---
(your example)
Where field parent is apparently a taxonomy term reference?
I looked/checked for a similar construction on my site and can only find the following - without the :path on the end:
The - field_taxo_category - portion is an actual field name, which would vary from site to site.
Would it be correct that if the - [node:field_taxo_category:entity:url:path] - construct exists it would generate a relative URL, while the previous form generates a fully qualified URL?
Would you verify the existence of the [ ... :entity:url:path] token construct?
(actual token set on my site when I checked for the - entity:url:path - construct)
Comment #9
websiteworkspace commentedWhere the taxonomy reference field for a taxonomy of node categories, include a hierarchy of categories, is:
field_taxo_category
The following token construct can be used as the pathauto module url pattern to generate the complete URL for the node:
Even if the category (taxonomy term) is deep in a taxonomy hierarchy, the pattern above will yield a URL containing all the terms in the hierarchy.
Comment #10
rwilson0429 commented#9 worked for me even though the entity:url:path token doesn't show up when I browse the available tokens. Thanks websiteworkspace
Comment #11
subson commentedSo the latest code in cleanTokenValues() with safe_tokens is failing for pathauto latest version vs pathauto 8.x-1.2
seems like putting the complete field name(field_taxonomy_path) in safe tokens is the solution in our case.
Comment #12
berdirYes, that was a bugfix, it is expected to match whole token parts, otherwise it matched too much as path or url could appaear anywhere in some other token and it would have not transformered it properly. Unfortunately hit you the other way round.
Comment #14
sic commentedi am currently experiencing this also, running 1.8
Comment #15
darktek commented#2 comment related to the punctation settings did the work for me, thx!