Skip to content

Add search term to URL fragment for shareable search links#20

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/update-fragment-url-search-filter
Draft

Add search term to URL fragment for shareable search links#20
Copilot wants to merge 2 commits into
mainfrom
copilot/update-fragment-url-search-filter

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 18, 2025

This PR adds the ability to share URLs with search filters applied. When a user searches for models in the pricing table, the search term is now automatically saved to the URL fragment, making it easy to share links with specific model filters.

Changes

The search term is stored using a short URL parameter q to keep URLs concise. For example, searching for "claude" results in a URL like https://llm-prices.com/#q=claude.

Implementation Details

  • URL Persistence: The search term is saved to and restored from the URL hash parameter q
  • Seamless Integration: Works alongside existing URL parameters for tokens, costs, sorting, and model selection
  • Automatic Cleanup: The q parameter is automatically removed from the URL when the search box is cleared
  • URL Encoding: Properly handles multi-word searches (e.g., "gpt mini" becomes #q=gpt+mini)

Example Usage

Users can now:

  1. Search for specific models (e.g., "claude", "gpt mini", "gemini flash")
  2. Share the URL with the search filter preserved
  3. Reload the page or send the link to others, and the search will be automatically restored

Screenshot

Search URL Feature

The screenshot shows the search box with "claude" entered, the filtered table showing only Claude models, and the URL containing #q=claude.

Original prompt

This section details on the original issue you should resolve

<issue_title>Update fragment URL with current search filter term</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #19


💡 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.

Co-authored-by: simonw <9599+simonw@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying llm-prices with  Cloudflare Pages  Cloudflare Pages

Latest commit: 92a6dbe
Status: ✅  Deploy successful!
Preview URL: https://174bb89d.llm-prices.pages.dev
Branch Preview URL: https://copilot-update-fragment-url.llm-prices.pages.dev

View logs

Copilot AI changed the title [WIP] Update fragment URL with current search filter term Add search term to URL fragment for shareable search links Oct 18, 2025
Copilot AI requested a review from simonw October 18, 2025 19:50
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.

Update fragment URL with current search filter term

2 participants