Skip to content

Integrate categories page with unified search controller#10

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/redesign-categories-page-search-integration
Draft

Integrate categories page with unified search controller#10
Copilot wants to merge 4 commits into
mainfrom
copilot/redesign-categories-page-search-integration

Conversation

Copilot AI commented Feb 16, 2026

Copy link
Copy Markdown
Contributor

Categories page links directly navigate to category-filtered results instead of routing through a unified search. This creates inconsistent UX and duplicated pagination/filtering logic.

Changes

Template updates

  • categories.html: Redirect all category/subcategory links to /search/category?slug={slug} instead of /categories?category={slug}

Controller redirects

  • CategoriesController: Add redirect from /categories?category={slug}/search/category?slug={slug}
  • New endpoint /categories/{slug}/search/category?slug={slug} for direct category URLs
  • Preserve pagination parameters across redirects
  • Use UriComponentsBuilder for safe URL parameter encoding

Testing

  • Add CategoriesControllerTest with coverage for redirects, pagination, hierarchical categories, and edge cases

Example

@GetMapping("/categories/{slug}")
public String categoryBySlug(@PathVariable("slug") String slug,
                             @RequestParam(value = "page", defaultValue = "0") int page) {
    UriComponentsBuilder builder = UriComponentsBuilder.fromPath("/search/category")
            .queryParam("slug", slug);
    if (page > 0) {
        builder.queryParam("page", page);
    }
    return "redirect:" + builder.build().toUriString();
}

Existing SearchController /search/category endpoint and shop-list.html pagination already handle category-filtered results correctly.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 16, 2026 17:38
Co-authored-by: oricha <2244618+oricha@users.noreply.github.com>
Co-authored-by: oricha <2244618+oricha@users.noreply.github.com>
Co-authored-by: oricha <2244618+oricha@users.noreply.github.com>
Copilot AI changed the title [WIP] Redesign categories page for search integration Integrate categories page with unified search controller Feb 16, 2026
Copilot AI requested a review from oricha February 16, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants