Repository navigation
fix: OpenSearch on forums whose homepage isn't the discussion list - #5328
Merged
Merged
Conversation
Searches went to /?q=, which only searches when the discussion list is the homepage: any other homepage ignored the query. When it is the homepage, the frontend has nothing at /all, so the address now depends on the default route. The description is also served as application/xml, which browsers show when the address is opened rather than download, and gains Tags and an example Query.
9 of 12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: no issue filed. Follow-up to #5321.
Changes proposed in this pull request:
The OpenSearch description always sent searches to
/?q={searchTerms}. That only works when the discussion list is the homepage. With a different homepage, such as Tags, the search opened that page and ignored the query. When the discussion list is the homepage, the frontend has nothing at/all, so that address can't be used unconditionally either. Searches now go to/when the default route is/all, and to/allotherwise. A tag page set as the homepage therefore gets a forum-wide search rather than one inside that tag.Also:
application/xml. Browsers downloadapplication/opensearchdescription+xmlwhen the address is opened rather than show it. Neither Firefox nor Chrome checks the type when it loads the description, and Discourse serves the same type. The skeleton's.htaccessalso expiresapplication/xmlimmediately, where an unlisted type got a month.<Tags>and an example<Query>are added, as the OpenSearch 1.1 spec suggests. The example uses the forum's title, the term most likely to have results in any language.Reviewers should focus on:
…/all?q={searchTerms}, and a search from its address bar showed results. Chrome stored the same address.moz:SearchFormstays at the forum's root. Firefox uses it as the engine's main page, opened with no terms; it isn't a search template.Necessity
Confirmed
yarn testinjs/). (No frontend changes.)composer test).