SEO-friendly Views: How do I make contextual filters work together with exposed filter criteria?


You're nearly there, but you need to replace your exposed filters with equivalent Views arguments (i.e. Country and City). Then if you change the view's 'page' display path from frontpage to frontpage/%/%, each percent will be mapped to the arguments in the order they appear.

Once the above is done you can still use exposed filters for other fields to control the view, but they will need to be other for fields. If you need to change the city/country arguments inside the %, look into making a 'Jump menu' view display to provide a drop-down to control the view, rather than an exposed filter. Also see the Jump module.

If you need more power, a related alternative is to re-create the page in Panels which will allow you to pass arguments to several views in different panes at the same time. Views should do the job on its own for you, though.

Tags: Views

Similar questions

Issue using Exposed filters along with contextual filters in views
I have a view page listing my stories/articles. I have a contextual filter based on the field Country which is a taxonomy term reference field. I have defined the path of the page as article-search/% to accommodate the contextual filter value. I have an exposed filter on the field article-category which is also of type taxonomy term reference. I us...
Views: how to make an OR condition between filters and contextual filters
I have been able to separate Views filters into groups and apply an OR condition, following this article: I also understand how to use the hook_views_query_alter() to make a few contextual filters act with an OR statement between each contextual filter. What I can't figure out is this: ho...
Views exposed filters - how to show "You searched for [exposed filters]" above results?
I'd like to summarize the current filters used on the data in the results. What's the easiest way to do this? Thanks!
Decouple all the exposed filters in Drupal with each other and make each exposed filter as a separate block
I have created a custom content type and using views2 for creating various page-views. I have used a taxonomy (having 4 terms, say "A", "B", "C" and "D") for broader categorization of this content type. There are 4 other taxonomies corresponding to each of the above terms "A", "B", "C" and "D" called "Taxonomy-A", "Taxonomy-B", "Taxonomy-C" and "Ta...
How to use views filter criteria in a custom exposed view filter?
I am using Drupal 8.7.11 and have created a custom views exposed filter which provides users the option to filter an entity reference field using a checkbox list of names instead of autocomplete. At the moment I have hardcoded the query conditions to build the list in a entity query with certain content checks e.g. date is in the future However I w...
Pros and cons of exposed filters versus contextual filters
I need to do some complicated filtering on my View and it seems that contextual filters lack the operators (e.g. between, greater than) available within the exposed filter configuration. However, I don't want to user to be able to see or amend any filter widgets. I can achieve this by setting the exposed filters to appear as a block and NOT assigni...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.