0

After creating a view to allow /taxonomy/term/(name) to show content tagged with that term, I am trying to find where I can override the generation of field links (field_type_taxonomy_term_reference) so that they create links following this format. Currently they still show the id number for the term at the end. I have tried (mytheme)_preprocess_taxonomy_term and altering $variables['term_url'] but that hasn't worked. Can anyone please give me any pointers about how to do this, I am running out of ideas.

Any thoughts welcome.

Cheers Paul

1

You should be able to set URL aliases for your taxonomy terms using the Path module that comes with Drupal core. (EDIT: As mentioned by jordojuice, you'll also need the Pathauto module to automatically generate these patterns in the manner I instruct below).

  1. Go to the Configuration menu and select "Url Aliases" in the "Search and Metadata" section. (admin/config/search/path)
  2. In the upper tab of the URL Aliases menu, select "Patterns." Here you can set the path to your taxonomy terms to whatever you'd like.

The only problem is that I don't think Views overwrites the URLs generated. There was a module for this in Drupal 6, but I don't think there is anything similar for D7.

There is a View that comes default in Views that should overwrite the default taxonomy paths; you could see what it does and try to tweak it.

  • 1
    If you end up working with URL aliases (a great feature) you should definitely check out Pathauto as well. – jordojuice Sep 10 '11 at 1:28
  • This is useful but it is not what I was after. I may have to just hack core instead - changing 1 line does what I want. Surely it can't be this hard to overwrite in a better, standards orientated way? – Paul Barrett Sep 12 '11 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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