Skip to content

Retain curation and orderby get parameters, when clicking on a category button #707

@benniledl

Description

@benniledl

Summary

On the WordPress.org Pattern Directory, when you click on a category, the current community/curated and orderby GET parameters are not retained in the URL, causing the selected curation and sorting order to be lost.

Additionally, when performing a search, only the ?s= parameter is used, without including the curation and sorting order filters. The category links should append these parameters, and it's worth considering whether the search functionality should also retain them or not.

Detailed

On the WordPress.org Pattern Directory, there are four different filters available:

Category (e.g., "All", "Featured", "Posts", etc.)
Search (input field for searching patterns)
Curation (toggle between "Community" and "Curated")
Sorting Order (dropdown to select sorting, e.g., "Newest")

Currently, the curation (community/curated) and sorting order (orderby) filters are managed through GET parameters in the URL. However, there are a couple of issues with how these parameters are handled when interacting with the UI:

Category Links:

When a user clicks on a category (e.g., "Featured", "Text", etc.), the link navigates directly to the category page without appending the current community/curated and orderby GET parameters.
Expected Behavior: The category links should retain the current curation and sorting order parameters, appending them to the URL.

Search Functionality:

When a user performs a search, the current community/curated and orderby parameters are not added to the search query. The search query only uses the ?s= parameter.
Expected Behavior: It's debatable whether the curation and sorting order should persist in the search results. However, consistency would suggest these parameters should be preserved unless there's a strong reason not to.

Steps to Reproduce

Navigate to the WordPress.org Pattern Directory.
Apply a specific curation (e.g., "Community") and sorting order (e.g., "Newest").
Click on a category (e.g., "Text") or perform a search.

Expected Outcome

Category Links: The URL should include the current community/curated and orderby parameters along with the category slug.
Search Functionality: The URL should potentially include the community/curated and orderby parameters in addition to the ?s= parameter.

Actual Outcome

Category Links: The community/curated and orderby parameters are not appended, leading to a loss of the selected curation and sorting order.
Search Functionality: The search query also does not retainin the other filters.

Possible Solution

Update the links for categories to include the current community/curated and orderby GET parameters.
Consider whether the search functionality should also retain these parameters and update accordingly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Component] ThemeThe frontend of the pattern directory, pattern lists UI

    Type

    No type

    Projects

    Status

    🛑 Pending discussion

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions