-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Conversation
@mxnet-label-bot [pr-awaiting-review] |
@@ -1,17 +1,17 @@ | |||
function setVersion(){ | |||
let doc = window.location.pathname.match(/^\/(api\/.*)$/) || window.location.pathname.match(/^\/versions\/[^*]+\/(api\/.*)$/); | |||
let doc = window.location.pathname.match(/^\/versions\/[0-9.master]+\/([^*]+.*)$/); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this fail if the version user is looking at is master, where /versions/
is missing from the URL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep... good catch... I was testing the other side of the use case.
I've been thinking about a related point. I could just force all the default traffic to /versions/master. This would solve a variety of thorny issues. Also, help with analytics. WDYT about that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think I'd personally like to see /versions/xyz
in the URL all the time. In the future if we decide to change default to latest release rather than master, we can easily change the redirect and everything else should work as expected.
@safrooze @aaronmarkham - ping for next steps here |
@sandeep-krishnamurthy @safrooze I've re-enabled the preview. You should clear your cache to make sure you're getting the latest .htaccess file. |
@safrooze Could you please take a look into this PR? |
I'm basically stuck on some thorny regex. That's why I renamed this PR with the [WIP]. I'd like to make the regex a little looser so it lets through any call to /versions/{anything}, and redirects any /{anything but versions}/ back to the default. I'd appreciate help. The |
@aaronmarkham could you please elaborate more on the issue by providing an example? You can consider addressing the regex issue with another PR and have this PR move ahead. |
There are two competing routes to make this move forward.
|
@aaronmarkham are you able to fix the issue you mentioned above? |
@aaronmarkham ping for update, thanks! |
Closing this in favor of tackling the problems separately. The site should be updated to have traffic directed to the default version. Then we can improve search. |
Description
This PR improves version switching on the website. The new feature helps with searching for APIs mostly, but can also work for pages you're searching for that exist in different versions.
The current version selector will kick you to the home page from the search page. I fixed this behavior for the API section of the docs last week, but thought fixing search would be a big UX improvement too.
It's generalized now too.
#
and query strings?
.UPDATE: To deal with requests to the root of the website, I updated the redirects to point to the default version. Right now this means any request to / will go to /versions/master. Or requests to /tutorials/xyz go to /versions/master/tutorials/xyz.
Usage
As this is a javascript update, please be sure to clear your cache.
Let's say you're looking for
allreduce
, but for whatever reason you're on the v1.0.0 of the site (like coming in from Google):http://34.201.8.176/versions/1.0.0/search.html?q=allreduce&check_keywords=yes&area=default#
You get no results, but you're prompted to use the versions dropdown.
So you choose 1.3.0:
http://34.201.8.176/versions/1.3.0/search.html?q=allreduce&check_keywords=yes&area=default
You get a result.
Preview
Comment
It would be awesome if the search fails we have it return other versions as suggestions, but I'm not that familiar yet with how Sphinx does its search magic... so that can be another day!
Test Plan
@safrooze found a hole in the regex coverage, so I think it is worth identifying the various angles of entry and usage.