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.
I have a brand field wich have a & character
I want to keep this character in my field, but i would like to change it by a "and" in the url alias.
Any idea how to make it ?
Thanks for your answers
Comments
Comment #1
Jibus CreditAttribution: Jibus commentedMove this to the transliteration queue
Comment #2
amateescu CreditAttribution: amateescu commentedI think this is a question for Pathauto, not Transliteration.
Comment #3
Jibus CreditAttribution: Jibus commentedOops, sorry then =)
Finally, i have just override manually the alias into node form.
But the question remains if you have a lot of nodes where you want to convert the & into a "and"
Maybe it's possible with rules
Comment #4
ben.kyriakou CreditAttribution: ben.kyriakou as a volunteer commentedIt doesn't look like there's a straightforward way to do this natively in Pathauto without changing the available transformations for punctuation. The simplest way to do this is probably with
hook_pathauto_alias_alter()
. Ensure that Ampersands are set to "No action (do not replace)" at /admin/config/search/path/settings, then add ahook_pathauto_alias_alter()
in a custom module like this:This will then replace any ampersands in your URL with the word 'and'.
I'm going to mark this as Fixed since this should solve your issue, but if you have further questions please set it back to Active. If you'd like this to be a fully-fledged feature of the module, then consider filing this as a Feature request.