I have a taxonomy terms like:

  • christmas
  • wedding

How can I build a view with url page like this: www.site.com/% being % christmas or wedding,

If users go to www.site.com/christmas just display nodes with christmas taxonomy.

If users go to www.site.com/wedding just display nodes with wedding taxonomy.

I have to do n views with same fields that why I want to do just one generic view.

  • 1
    Why not just use pathauto and make the aliasing rule [term-name] or whatever the appropriate token is? Also, you can create one view and tell vocab + vocab terms to use that view or views with a module like TVI. – Kevin Nov 28 '16 at 17:04

The PathAuto module allows you to easily change the URLs for the default taxonomy listings (which do what you describe).

Install the module and go to Administration > Configuration > Search and metadata > URL aliases.

You can set a pattern for your vocabulary that is just [term:name] BUT there are good reasons not to do that (for example if a category overlaps with a default path). Something like holiday/[term:name] is likely a better choice.

For more options on PathAuto see the recipes from Drupal.org.

If you need more control over the display you can override the view that generates term pages.

  • Seconded, you can do this but generally you should stick to [vocab-name]/[term-name] as a default alias as acrosman said. Views still work off of taxonomy/term/% path since it is a system path, and you can use someting like TVI to enhance the display of different vocabularies by using rendered entities instead of node fields. – Kevin Nov 28 '16 at 21:01

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.