readthedocs / addons

JavaScript client to integrate with Read the Docs nicely
https://readthedocs-addons.readthedocs.io/
MIT License
22 stars 6 forks source link

Search: URL query string with current search #21

Open humitos opened 1 year ago

humitos commented 1 year ago

The Sphinx extension supports ?rtd_search="my query" in the URL.

However, I removed this feature for now from the current implementation because it makes some things more complex at the moment. We should consider re-implementing it if we think it's useful.

Also, the same feature modifies the browser's history each time you perform a search, which is pretty annoying when you do multiple queries and then want to go back.

I don't think it's a good idea to modify the URL unless there are good reasons to do that. I'm happy to talk more about this feature, tho.

humitos commented 10 months ago

I think I'd be happy to add a 🔗 icon in the search modal that copy the original URL + ?readthedocs-search-query="<the query goes here>" into the clipboard, in case they want to share it. This will solves the problem of modifying the URL and changing the history each time a char is typed.

Once the URL with the search query is opened, the search modal will open automatically and the query will be performed, showing the results.

ericholscher commented 1 week ago

I'd love to see this work, so that we can link folks to a page with a search result.