Categories
Drupal Development Resources

Custom Paths for Taxonomy Menu in Drupal 7

The taxonomy menu module is an way to generate a menu of taxonomy terms assigned to nodes. Practical examples include:

  • Product catalogs
  • Blog topics
  • Node filters

You could achieve the same effect by manually creating a menu and updating the links occasionally, but that's slow and impractical for sites with a lot of constantly changing content.

The default behavior is to link to the term's page (e.g. taxonomy/term/tid). The problem with that is the output is not very pretty and it usually comes with just node titles and teasers. It will also show anything tagged with that term, meaning if you share the vocabulary across multiple content types, you'd see all content with that term, which is not always ideal. If you could pass the argument to a View, you can have a lot more control of the output.

In the Drupal 6 version, there's a convenient option on the Vocabulary edit page to set a custom path for the “Menu Path Type”:

In the Drupal 7 version, that option is conspiculously absent:

Entity Path to the Rescue!

The entity path module is the key to this missing feature.

It allows you to redirect the links generated by taxonomy menu, as well as redirect links anywhere a term link is generated.

Just select the taxonomy term bundle from the “Instance” list then fill in the “Path Pattern” of where it should get redirected to.

5 replies on “Custom Paths for Taxonomy Menu in Drupal 7”

Thai, now that the Taxonomy Menu module’s 2.x module is in alpha for drupal 7 custom path is available out of the box. It does not appear to use tokens however… which is unfortunate, because I need that functionality. So actually, I might still end up using your way. Maybe you could do an update on this awesome post though?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.