0

I have a D7 view displaying all items tagged "food" at

mysite.com/industry/term/food

But my taxonomy terms for "industries" link to e.g. mysite.com/industry/food (i.e. without /term/)

I thought I could update the view to make the page path: /industry/% instead of: industry/term/% but that breaks the view

so I thought I might be able to update my Taxonomy url aliasing pattern to be:

[term:vocabulary]/term/[term:name]

instead of [term:vocabulary]/[term:name] but that doesn't work either :( or at least, it doesn't update all pre-written aliases...

I read this: http://www.webbykat.com/2012/04/overriding-default-taxonomy-page-view-drupal-7 which pointed to a solution from 2009 here https://www.drupal.org/node/394062#comment-1953504 but if I use Name or ID (rather than "name converted to ID") in my contextual filter it breaks the view

What am i doing wrong - I'm sure it's something simple and I'm just being blind!?

2 Answers 2

0

You mentioned that changing the alias doesn't update all pre-written aliases. Could you pick one term, edit it, and hit "Automatic alias" under URL aliases so that it updates, then post whether that resolved the issue for that individual term?

If so, all you need is to bulk update aliases for that vocabulary, which can be done with a VBO - I'll detail how if that's the issue.

1
  • thanks @webbykat - I tried what you suggested and edited the taxonomy term "food" in the "industry" taxonomy to make its url alias industry/term/food rather than just industry/food but strangely that didn't work either. I now don't get the view at mysite.com/industry/term/food or mysite.com/industry/food :(
    – olisb
    Jul 24, 2015 at 11:43
0

This method of overriding the taxonomy listing page with a view allows you to design a view which replaces the taxonomy listing page for all taxonomies.

It is important to note that this method only allows you to design one view which overrides all of the taxonomy term listings pages for items in any taxonomy.

As you have discovered, you can do this by creating or enabling a view which uses the special system path with exactly this text: 'taxonomy/term/%'. The views module provides an example, which by default which is disabled.

To understand what is happening, look at the addresses for each item when you edit the term. You will see these when you click 'edit' on any taxonomy term. eg. 'industry/food' the system edits this as 'taxonomy/term/15'.

You can edit the path settings for each term item individually, but it is useful to assign the pattern using Path auto from 'Configuration' -> 'URL aliases' under the Patterns' tab. You mention trying '[term:vocabulary]/[term:name]', but that this didn't change the path for existing items.

Then next step would be to either edit each old term item separately to assign a path for each one. Or you could use the 'delete aliases' tab in URL aliases admin to delete all existing aliases for taxonomy terms, and then 'bulk update' for taxonomy terms to apply the new pattern.

1
  • Thanks @digitalsean. As mentioned in the comment above in reply to webbykat I tried what you suggested, by adding 'term' in-between [term:vocabulary]/[term:name] for the "food" tag but it didn't help. Not really sure why as your logic makes sense to me. Any other ideas?
    – olisb
    Jul 24, 2015 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.