Hi there,

Apologies if this issue has been discussed before, but I've not found any reference to it through searching.

I'm using the [menupath] option for generating node aliases for the pages on my site. One of the pages is titled "News & Events". Pathauto generates an alias for this page as [menupath]/news-%26-events/. Instead, I'd prefer it if the ampersand were stripped out completely, which would leave me with the alias of [menupath]/news-events/.

I've tried adding '&', '&amp', and '%26' to the "Strings to Remove" option under General Settings, but to no avail.

Is this possible?

Thanks!
Rob

Comments

HorsePunchKid’s picture

Status: Active » Closed (duplicate)

I think you've got the same problem that's being addressed here. There are some possible fixes in that discussion, but nothing final, I think.

robschmitt’s picture

Thanks for you reply.

Waht I really wanted to know was whether I could manage it without having to hack the pathauto module. It seems like there is no other option though, so I've inserted a simple bit of code to replace ampersands in the pathauto_cleanstring function in pathauto.inc:

$output = str_replace('&', '', $output);

This has gone in on line 110 just before whitespace is replaced by the separator character.

greggles’s picture

I promise there will be a solution to this by the end of October. No need to hack then.

robschmitt’s picture

That'd be brilliant, thanks!

I work for a British digital agency building (primarily) Drupal-based websites. Pathauto is one of the first modules I download when I begin a new site. Top work!