I'm making a contextual filter, to pass along an argument from a panel to a view, using Content: Has taxonomy term ID.

This is so that it pulls in a keyword from a URL.

However, I want it to work so that when no keyword is passed in, it goes based on the last URL parameter.

For example:


It should pull ONLY things with both tech and startup if this is passed.

However, if the URL is just:


Then it should show ALL articles with the tech taxonomy term.

How do I do this?


You can use Exceptions setting in views like below

enter image description here

And point your menu link to www.example.com/tech/all instead of www.example.com/tech

  • 1
    Working fine. Is there any option to avoid all option? – Rajesh Vishwakarma Jun 3 '17 at 17:26

For Drupal 8.

Step 1:

Add the all exception as described in the Anil Sagar's answer.

Step 2: Alter the views route.

Step 3: In the alter: add a default value for the argument. Here is an example for the first argument in the view.search.page route:

   * {@inheritdoc}
  protected function alterRoutes(RouteCollection $collection) {
    if ($route = $collection->get('view.search.page')) {
      // Allow the views to have an optional argument.
      $route->setDefault('arg_0', 'all');

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.