Skip to content

Conversation

@sarthakmahapatra05
Copy link

Description

This PR adds a search bar to the Blogs page, enabling users to easily find specific blogs as the number of blogs grows.

Changes Made

  • Backend (server/controllers/BlogControl.js): Modified getAllBlogs to accept a q query parameter and filter blogs using MongoDB regex on title, description, and author.username fields.
  • API (src/service/oprations/BlogApi.jsx): Updated getAllBlogs function to include search query in API calls.
  • Frontend (src/Pages/Blog.jsx): Added search input bar above the blog grid with debouncing, URL query parameter support, and responsive design.

Features

  • Real-time search with debouncing to reduce API calls
  • Search by title, author, or description
  • Shareable search URLs via query parameters
  • Pagination resets on new search
  • Responsive and accessible UI
  • "No results found" message for empty searches

Testing

  • Verified search filters blogs correctly
  • Confirmed URL updates with search terms
  • Tested responsive design on different screen sizes
  • Ensured accessibility with proper ARIA labels

Close #159 (if applicable)

@netlify
Copy link

netlify bot commented Sep 12, 2025

👷 Deploy request for cleanbreath pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 662736c

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.

Add a search bar to the Blogs page to improve discoverability

1 participant