Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If you change the Hyphen in punctuation settings to either 'Replace by separator' or 'No action (do not remove)', it is always removed. The same happens to other punctuation that might be set as the punctuation separator instead.
Comments
Comment #1
Dave ReidCould you maybe give an example?
Comment #2
aaron CreditAttribution: aaron commentedah, never mind. i just realized it's a case of user error.
what i'm trying to do is create patterns using integers, which are from -n to n, including the hyphen, in the automatically generated path.
for instance, i have something like the following:
[node:field-world]/[node:field-x]/[node:field-y]
I expect it to produce results like:
beta/-67/49
beta/67/49
but it instead gives me:
beta/67/49
beta/67/49-0
how can i create a pattern like what i'm looking for?
Comment #3
aaron CreditAttribution: aaron commentedi've tried a few other cases, and have it working after a fashion, by setting the separator to anything other than a hyphen, for instance with a period, and telling it to not remove a hyphen. however, if i then set the period to 'remove', the page tells me some paths will be broken.
Comment #4
aaron CreditAttribution: aaron commentedthat would also leave my other urls looking really ugly.
Comment #5
aaron CreditAttribution: aaron commentedComment #6
Freso CreditAttribution: Freso commentedActually, I'd say that your initial example should work. With hyphen as a separator, and settings for hyphen set to "do not remove", then hyphens shouldn't be removed (unless there are two, i.e. "--", where one should be removed). Dave, do you agree?
Comment #7
aaron CreditAttribution: aaron commentedout of curiosity, i set it as [node:field-world]/x[node:field-x]/y[node:field-y] but it gave me:
for -1, 1 beta/x1/y1
for 1, -1 beta/x1/y1-0
maybe it doesn't like a leading hyphen?
Comment #8
Dave ReidThis is due to Pathauto's cleaning of separators (it cleans any multiple, leading, or trailing separators in each token's value) so supporting such an edge case is a feature request which I'm not sure we'd be able to do. :/