Skip to content
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

Change the default URL of doc.rust-lang.org #1826

Merged
merged 5 commits into from
Sep 18, 2017
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions text/0000-change-doc-default-urls.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
- Feature Name: N/A
- Start Date: 2016-12-22
- RFC PR:
- Rust Issue:

# Summary
[summary]: #summary

Change doc.rust-lang.org to redirect to the latest release instead of an alias
of stable.

# Motivation
[motivation]: #motivation

Today, if you hit https://doc.rust-lang.org/, you'll see the same thing as if
you hit https://doc.rust-lang.org/stable/. It does not redirect, but instead
displays the same documentation. This is suboptimal for multiple reasons:

* One of the oldest bugs open in Rust, from September 2013 (a four digit issue
number!), is about the lack of `rel=canonical`, which means search results
are being duplicated between `/` and `/stable`, at least ([issue link][9461])
* `/` not having any version info is a similar bug, stated in a different way,
but still has the same problems. ([issue link][14466])
* We've attempted to change the URL structure of Rustdoc in the past, but it's
caused many issues, which will be elaborated below. ([issue link][34271])

[9461]: http://github.com/rust-lang/rust/issues/9461
[14466]: https://github.com/rust-lang/rust/issues/14466
[34271]: https://github.com/rust-lang/rust/issues/34271

There's other issues that stem from this as well that haven't been filed as
issues. Two notable examples are:

* When we release the new book, links are going to break. This has multiple
ways of being addressed, and so isn't a strong motivation, but fixing this
issue would help out a lot.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kind of links would break, and why?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As one example, the new book does not have the same chapters as the old book, so for example, https://doc.rust-lang.org/stable/book/conditional-compilation.html will be a dead link someday.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that chapter is removed, an appropriate redirect should be added like we have for https://doc.rust-lang.org/guide.html.

* In order to keep links working, we modified rustdoc [to add redirects from
the older format](https://github.com/rust-lang/rust/issues/35020). But this
can lead to degenerate situations in certain crates. `libc`, one of the most
important crates in Rust, and included in the official docs, [had their docs
break](https://github.com/rust-lang/libc/pull/438) because so many extra
files were generated that GitHub Pages refused to serve them any more.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of rust-lang/rust#38858 the libc docs are no longer included with the std docs.

Also libc isn't exactly special. It did hit a rather bad bug in rustdoc (rust-lang/rust#37773) which caused way too many files to be generated. The redirects simply doubled the number of files rustdoc generated but that is true of every crate.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It still affects how the crate hosts its docs, even though they're not included in the distribution.


From `#rust-internals` on 2016-12-22:

```text
18:19 <@brson> lots of libc docs
18:19 <@steveklabnik> :(
18:20 <@brson> 6k to document every C constant
```

Short URLs are nice to have, but they have an increasing maintenance cost
that's affecting other parts of the project in an adverse way.

The big underlying issue here is that people tend to link to `/`, becuase it's
what you get by defualt. By changing the default, people will link to the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: "defualt"

specific version instead. This means that their links will not break, and will
allow us to update the URL structure of our documentation more freely.

# Detailed design
[design]: #detailed-design

https://doc.rust-lang.org/ should issue a redirect to https://doc.rust-lang.org/RELEASE,
where RELEASE is the latest stable release, like `1.14.0`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One concern I have with this: This will result in more people linking to https://doc.rust-lang.org/<RELEASE> URLs. This means that more people are going to be looking at potentially outdated documentation after new releases happen. I think this should at least be mentioned in the # Drawbacks section.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The solution to this is straight-forward: an "this is old documentation pls go here for current stable" banner.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example: outdated Django and development Django have banners at the top, and https://docs.djangoproject.com/ redirects to the current latest version, https://docs.djangoproject.com/en/1.10/.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have historically resisted doing that because it means modifying an old release after the fact.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use an Iframe or server side magic to avoid modifying it? I agree downloaded/released docs should be immutable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, those are possible options. This is an implementation concern, not an objection to the whole idea.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Boost hit this problem as well. http://www.boost.org/libs/regex/doc/html/index.html redirects to a version-specific url, and they needed to add the "click here for latest version" link because all the stack overflow posts, for example, were pointing to ancient documentation.


Part of the release process will be updating this redirect.

# How We Teach This
[how-we-teach-this]: #how-we-teach-this

There's not a lot to teach; users end up on a different page than they used to.

# Drawbacks
[drawbacks]: #drawbacks

Losing short URLs is a drawback. This is outweighed by other considerations,
in my opinion, as the rest of the RFC shows.

# Alternatives
[alternatives]: #alternatives

We could make no changes. We've dealt with all of these problems so far, so
it's possible that we won't run into more issues in the future.

We could do work on the `rel=canonical` issue instead, which would solve this
in a different way. This doesn't totally solve all issues, however, only
the duplication issue.

We could redirect all URLs that don't start with a version prefix to redirect to
`/`, which would be an index page showing all of the various places to go. Right
now, it's unclear how many people even know that we host specific old versions,
or stuff like `/beta`.

# Unresolved questions
[unresolved]: #unresolved-questions

None.