1

I set up a search criteria using taxonomy terms to filter content. The taxonomy and filter work great. The problem is the links return like www.example.com/work?tid=1 but instead I would like the filter links to use the taxonomy term name like www.example.com/work/logo. I have tired to set a alias on the terms but it keeps referring to the tid. The has taxonomy option only allows you to change the name of the identifier before the ? But the link still shows the =1 id after the identifier.

1

2 Answers 2

1

you can use Pathauto contrib module.

The Pathauto module automatically generates URL/path aliases for various kinds of content (nodes, taxonomy terms, users) without requiring the user to manually specify the path alias. This allows you to have URL aliases like /category/my-node-title instead of /node/123. The aliases are based upon a "pattern" system that uses tokens which the administrator can change.

https://www.drupal.org/project/pathauto

2
  • This probably won't help, because the OP tried already to set an alias and automatically doing this wouldn't make a difference.
    – 4uk4
    Oct 26, 2018 at 6:54
  • I'm currently using pathauto and it doesn't work with search criteria. thank you for the suggestion though. Oct 26, 2018 at 16:28
1

You're probably using Content Views type, assuming from what you've written.

You have to introduce the term name into Views if it's not available, which it isn't out of the box if you have Content Views.

You do that by adding a Relationship to the Field that references that taxonomy. Once you add the Relationship you will have the Taxonomy term: Name option under Filters, expose it, set its Filter identifier to your preferred word (I'm guessing work is the name of your field) and when used the link will be something like:

www.example.com/your-views-page-path?yourtagidentifier=events

for example:

www.example.com/content?work=logo

To customize the link further you can use an additional module: Query Parameters To URL to get:

www.example.com/content/work/logo

Views URL alias module might also be relevant.

4
  • I tried to follow your suggestion but seems like i'm missing something or not doing it correctly. I'm still getting the same results of www.example.com/your-views-page-path?yourtagidentifier=1 Oct 26, 2018 at 19:37
  • Have you added the Relationship? Can you update your question with the information about your new configuration (Which Relationship, Which exposed filter and configuration)? Are you using the Query Parameters to URL module yet? (Better leave that for last.)
    – prkos
    Oct 26, 2018 at 20:12
  • Once you add the Relationship you will have the Taxonomy term: Name option under Filters, expose it. Where do I complete this after I have added the relationship? Under search criteria? Oct 26, 2018 at 20:34
  • It's under Filter criteria. You will see a lot more fields available under Filters after you add the Relationship. You will want to add a new Filter called Taxonomy term: Name Filter, it will be under Taxonomy term Category if you want to filter the Filters list to find it faster.
    – prkos
    Oct 26, 2018 at 23:20

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.