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.
There are a lot of configurable symbols in the pathauto settings (admin/config/search/path/settings).
However there aren't any settings for registered trademark (®) and trademark (™) symbols. I have a client that has a lot of node titles containing these characters, so I have patched the module to include them.
Comment | File | Size | Author |
---|---|---|---|
#1 | pathauto-trademark_symbols-2065369.patch | 1.02 KB | zhuber |
Comments
Comment #1
zhuber CreditAttribution: zhuber commentedI also added the copyright symbol, for good measure.
Comment #2
Dave ReidYou could just enable the 'Reduce to ASCII' option in Pathauto?
Comment #3
zhuber CreditAttribution: zhuber commentedAhh...I didn't see that option.
Well, I think this is still a viable alternative if you didn't want to use the 'Reduce to ASCII' option.
Comment #4
enekoalonso CreditAttribution: enekoalonso commented@Dave Reid, that solution does not work if you want to allow unicode URLs (for other languages).
In my opinion, Pathauto should allow to provide a custom list of symbols to be replaced, the same way it allows providing a list of words to be removed.
Comment #5
enekoalonso CreditAttribution: enekoalonso commentedActually, it seems like there is a hook that can be used for this purpose (still would be nice to be able to do it through the UI):
Comment #6
joshuautley CreditAttribution: joshuautley commentedI patched the production release for this module and while I see the options on settings the registration symbol is not being removed.
Per Dave's suggestion I do not see "Reduce to ASCII" option in settings. Is this only available in the dev release?
Thanks in advance for any input on this.
Comment #7
mibfire CreditAttribution: mibfire commentedjoshuautley,
If you dont want to use unicode urls
then you have to turn off "Transliterate prior to creating alias" option, enable "Reduce strings to letters and numbers" option, and you dont need any patch for this or hook_pathauto_punctuation_chars_alter.
But there is a problem if your string contains characters with accent cos this case you have to use "Transliterate prior to creating alias" option and symbol will be converted with transliteration(for example: ™ -> TM) and after you cant remove this using "Punctuation" settings!
Solution:
If you want to use unicode urls
then you have to turn off "Transliterate prior to creating alias" and "Reduce strings to letters and numbers" options, and use https://www.drupal.org/node/2065369#comment-7755491 patch to remove the symbols.
Comment #8
JABurns103 CreditAttribution: JABurns103 as a volunteer commentedThe simplest solution is to select "Reduce strings to letters and numbers", and then you have to add the html character codes to the "Strings to Remove" box.
For example
Trademark ™ = & #8482;
Registered ® = & #174;
Copyright © = & #169;
*remove the space after the &
Comment #10
temkin CreditAttribution: temkin as a volunteer commentedPlease see a comment here.