I'm not quite sure if this is the correct place to post about this issue, but I gotta start somewhere.

What I'm trying to make is a page that has products/%product/images URL. So I tried the following:

1) Create page
2) Set Argument: Taxonomy term: ID
3) Change Argument type to: Term name and checked "Inject hierarchy into breadcrumb trail" & Transform dashes in URL to spaces in term name filter values

To make myself clear, here's an example and what happens with the url:

Product called: "Som' product & test:ing"
URL: products/som%27-product-%26-test%3Aing/images

Why doesn't it encode/remove these?

Sorry if this is any kind of duplicate but I couldn't find this anywhere. Thanks in advance!

Comments

merlinofchaos’s picture

'these'

What do you mean by these?

ifish’s picture

These: %26, %27 etc. I'm not sure what these are called.

ifish’s picture

if there is some quick fix/edit I could do in the code I'd be really thankful.

merlinofchaos’s picture

Status: Active » Closed (won't fix)

Those are HTML entities. Since you're doing a lookup on the term name, you can't really strip them out and expect the lookup to still work.

The best way to do this would be to use a Computed Field on your entity and write a small bit of PHP to strip out anything you don't want and make a "URL safe" field that you can then use for lookups like that.

You might ask why pathauto doesn't work that way, and it's because it actually more or less does -- but instead of being a field, there's a lookup table that says something like:

URL "foo/bar/baz" translates to "node/1"

You can't strip encoding on the fly and expect the lookups to work.

ifish’s picture

Thanks for your reply but can you please clarify this?:

The best way to do this would be to use a Computed Field on your entity and write a small bit of PHP to strip out anything you don't want and make a "URL safe" field that you can then use for lookups like that.

--

Is there any kind of documentation/help for this? I've been struggling with that problem for a long time with drupal to have:
product/name
product/name/images
product/name/videos

Thanks in advance.

merlinofchaos’s picture

Sorry, nothing I know of. I find it odd that there isn't more out there about doing this. It's a common need but it doesn't seem to be very commonly implemented.