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

Online documentation version switcher #30062

Closed
Carreau opened this issue Nov 25, 2015 · 7 comments
Closed

Online documentation version switcher #30062

Carreau opened this issue Nov 25, 2015 · 7 comments
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@Carreau
Copy link
Contributor

Carreau commented Nov 25, 2015

Hi, I'm astonished to not have found a similar issue, I apologize if it does exist but I didn't found it. I might have used the wrong terms.

It would be convenient in the online docs to turn the div#versioninfo into a doc version switcher.

div#versioninfo is this thing on the bottom right corner of documentations pages:
screen shot 2015-11-25 at 23 01 02

At least a stable/nightly selector. I can imagine a switch between major versions later. It is not obvious for the newcomer what the URL scheme is. I just tried a few before figuring out it was nightly and not latest.

You think might want also to set a <link rel="canonical" href="http://doc.rust-lang.org/path/to/same/stable/page" /> to avoid google indexing the nightly too much, and also as the same page is available under /foo.html and stable/foo.html, that should (IIUC) de-duplicate search results and increase ranking.

I'm not too sure of where to fix that, and where are all the valid urls published on docs.rust-lang.org.

Thanks.

@steveklabnik
Copy link
Member

I believe this is #24336 and rust-lang/cargo#1681 and also elements of #14466

So yeah, nothing exact, but similar.

@steveklabnik steveklabnik added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jun 6, 2016
@steveklabnik steveklabnik added T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. and removed T-tools labels May 18, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-feature-request Category: A feature request, i.e: not implemented / a PR. label Jul 24, 2017
@kzys
Copy link
Contributor

kzys commented Oct 5, 2018

I'm working on #44687 currently. The demo site is http://rust-pull-request.s3-website-us-east-1.amazonaws.com/44687/std/

@jyn514
Copy link
Member

jyn514 commented Nov 30, 2020

I don't think this needs to be a general purpose rustdoc feature, since docs.rs already shows different versions and you'll only ever have one version available locally. I do think this would be nice to have for the standard library though - I think that could be written with existing rustdoc features using --html-after-content and some javascript:

        --html-after-content FILES
                        files to include inline between the content and
                        </body> of a rendered Markdown file or generated
                        documentation

@jyn514 jyn514 added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. and removed T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Nov 30, 2020
@jyn514
Copy link
Member

jyn514 commented Nov 30, 2020

Mentoring instructions: First, write some JS that injects the right versions into the page, where the version number is now. Then, add it to the rust-lang/rust repo and add --html-after-content your_file.js around here:

.arg("--markdown-css")

If that works well, we can figure out if and how to backport this to the existing documentation.

@jyn514 jyn514 added the E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. label Nov 30, 2020
@ehuss
Copy link
Contributor

ehuss commented Nov 30, 2020

@jyn514 I think one of the solutions currently being looked at is to use Lambda@Edge to inject a switcher on doc.rust-lang.org (see https://internals.rust-lang.org/t/adding-outdated-notices-to-archived-versions-of-documentation/12281/17 and #44687. This would allow switching for all pages (not just the std API). There are various issues with a javascript-only approach that a server-side approach would work better (viewing docs locally, handling new releases, etc.).

@jyn514
Copy link
Member

jyn514 commented Nov 30, 2020

Should this be closed in favor of #44687 then?

@jyn514 jyn514 closed this as completed Nov 30, 2020
@ehuss
Copy link
Contributor

ehuss commented Nov 30, 2020

I think so, since the RFC covers this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants