-
Notifications
You must be signed in to change notification settings - Fork 212
Use rel=canonical to point to the latest version #1006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Linking #1120 as related. I'll note that the "go to latest version" link is part of the menu bar, which is pinned to the top of the browser window, so it's always visible even when mid-page. On mobile it's just a yellow triangle with no link, which is a bit confusing. |
Another thought on this: Right now, even if you click "go to latest version," you'll get a redirect to a page with an explicit version in the URL. I think before working with rel=canonical, which is hard to see if it's working, it would be beneficial to make it so the |
I'm really hesistant to do this, that will mean the caching from CloudFront is wrong and won't be invalidated when a new release is published. |
We could do a CloudFront invalidation of |
Here's the pricing on that, which seems reasonable: https://aws.amazon.com/cloudfront/pricing/
And from https://aws.amazon.com/blogs/aws/simplified-multiple-object-invalidation-for-amazon-cloudfront/:
|
By the way, this approach would help with another developer experience issue: For crates I use a lot, I often find them by opening a new Chrome tab and typing a few characters of the name, then selecting them from the history portion of the Omnibox. Right now that takes me to a specific version - but it becomes outdated once a new version is released, requiring an extra click to get to the latest version. And because Omnibox scores by number of visits, it can take a while before the latest version is the top choice. If most user navigations go to the "latest" URL, their autocomplete suggestions are more usable. |
Right, but it also means that links to |
Those links should be mostly stable across semver minor and patchlevel revisions, since removing or renaming an item would be an API break. |
latest doesn't care about patch versions though - it always goes to the latest version that's not a pre-release. I'm not saying we shouldn't do this, but we should take some care to make sure it doesn't make the user experience worse. |
Yep, that makes sense. To flesh out the idea more: The "stable" URL for any given major version could be like Another approach would be to not worry about major/minor versions, and offer permalink icons next to all internal anchors. The permalink would go to whatever the latest version is at that moment in time. This is similar to what GitHub does when you highlight a specific line of code and it offers a permalink in the |
OMG I'm so mad, I've been doing that by scrolling to the top, opening the commit in a new tab, and pasting the commit in place of Yeah, opt-in permalinks sound like the right way to do this. |
Yay, so glad to have introduced you to this! There's even a keyboard shortcut: |
I also think opt-in permalink is better. |
Is this really a valid use of A wild suggestion as an outsider - what if |
I agree rel="canonical" is not quite the right fit for this, and I like the idea of |
I was looking at the caching story here, and I think we actually wouldn't need to change anything. Looking at https://docs.rs/ureq/2.1.0/ureq/, for instance: that URL itself (i.e. the HTML page) doesn't have a Cache-Control header and consistently returns For subresources - almost everything is per-rustdoc-version, not per-crate-version. That's all cached, and its caching won't be affected. The one exception is search-index{...}.js. That's per-crate-version, but also has a unique URL for each crate version. For example, https://docs.rs/ureq/2.1.0/search-index-20210324-1.53.0-nightly-07e0e2ec2.js. And since the URL for the search index is part of the HTML page, it will get updated correctly on new builds and doesn't need to worry about caching. |
Hi, Id just like to add my 2 cents On the Part of the page with Versions the previous versions link href could have rel="nofollow" or "noindex nofollow" that would indicate that they are not popular. Also as far as I know to add rel="canonical" to the latest version is just a hint to search engines, so it should not break anything. A similar issue was first reported in 2013 rust-lang/rust#9461 (and is still open) I believe implementing this would improve the users experience, ie you get to see the latest documentation by default. Also, it would reduce the load on the server as users wouldn't land on one page only to click on the link to the latest version of the documentation. (Also you would reduce the load of bots indexing outdated documentation) Thanks |
I'd like to propose renaming this issue to "make latest version top result in search engines." The original proposal was to use rel=canonical for this purpose, but from subsequent research I think that won't work. The overall goal is findability from search engines. |
This is done! See also #1438. |
Uses the same mechanism as #74, but for a very different purpose.
A common problem using docs.rs is that it's hard to find the latest version of the docs from Google. We mitigate this by having a 'go to latest version' button, but if you land on a search result halfway down the page, the header bar isn't shown. A possible way to get better results is to abuse
rel=canonical
to point to/:crate/latest/:path
so it will be picked up by Google.It'd be feasible to put rel=canonical in the
<head>
since we inject styles there already.#74 should be implemented before this to avoid telling Google we are more canonical than the original documentation.
The text was updated successfully, but these errors were encountered: