Views Exposed filter UX: omit default and empty exposed filter values from URL

Created on 27 August 2017, almost 8 years ago
Updated 24 January 2025, 4 months ago

When I use views exposed filter with pager, each pager link contains all arguments, used in exposed filter, so even if I don't touch any exposed filter values - pager url contains many garbage empty and default arguments, for example:

http://example.com/catalog?manufacturer=All&price[min]=&price[max]=&power[min]=&power[max]=&width[min]=&width[max]=&height[min]=&height[max]=&depth[min]=&depth[max]=&sort_by=field_price_value&sort_order=DESC&page=2

instead of clean way:
http://example.com/catalog?page=2

Same problem if I use exposed filter and change only one field value, URL contains all values, including empty and default:
http://example.com/catalog?manufacturer=Hypnotoad&price[min]=&price[max]=&power[min]=&power[max]=&width[min]=&width[max]=&height[min]=&height[max]=&depth[min]=&depth[max]=&sort_by=field_price_value&sort_order=DESC

This give many problems with search engine indexing of Views filter results - URL contains many unnecessary values, and if we add new field to exposed filter or reorder fields - each old URL filter will be changed, so search engines will see many new urls and will reindex it, and exclude them as duplicated content.

Best solution for this problem is compare current exposed filter values with default, remove empty and default values and leave only actual used defined values.

✨ Feature request
Status

Active

Version

11.0 πŸ”₯

Component

views.module

Created by

πŸ‡¦πŸ‡²Armenia murz Yerevan, Armenia

Live updates comments and jobs are added and updated live.
  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡±Netherlands johnv

    better search on 'exposed filter'.

  • πŸ‡§πŸ‡ͺBelgium borisson_ Mechelen, πŸ‡§πŸ‡ͺ

    #18

    From my personal experience, views with tons of exposed filters are usually admin views (for which I couldn't care less about the URL), and for user facing views with lots of filters I'll always try to use Facets which doesn't have this problem. Β―\_(ツ)_/Β―

    This is now different with facets 3.x, which can now use views exposed filters instead of its own url handling, rendering and ajax handling.
    This means we now frequently get this question as well.

  • πŸ‡ΊπŸ‡ΈUnited States dww

    Running into this again.

    I still don't understand #19. Where's the redirect needed in #16? Views is creating a response with a pager full of links. Each of those links could be "scrubbed" to only include query arguments for filters (or sorts, or whatever) that are set to their default values. These links would all be totally valid. I do this manually all the time and it works just fine. No redirects needed.

  • πŸ‡ΊπŸ‡ΈUnited States dww

    dww β†’ changed the visibility of the branch 2904921-exposed-views-filters to hidden.

Production build 0.71.5 2024