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

doc.rust-lang.org should redirect to new on-topic page #18498

Closed
seanjensengrey opened this issue Oct 31, 2014 · 6 comments
Closed

doc.rust-lang.org should redirect to new on-topic page #18498

seanjensengrey opened this issue Oct 31, 2014 · 6 comments

Comments

@seanjensengrey
Copy link
Contributor

Inbound links to doc.rust-lang.org end up at a landing page that is confusing. Other issues entered against it are #14572 and #18300

I’d like to redirect inbound links to rust documentation to the new stuff, ideally, I’d like to point ambiguous links to the correct(ish) location for all time.

For instance,

If I am reading this story (from 4 months ago)

http://www.reddit.com/r/rust/comments/29fecw/doeswill_rust_support_lazy_evaluation_of_function/

a comment points me to

http://doc.rust-lang.org/core/option/type.Option.html#method.unwrap_or_else

which drops me off at the new 404 landing page

really, I want to get to

http://doc.rust-lang.org/core/option/enum.Option.html

There are a couple fun options to solve this.

  1. If you have a copy of the old site, we could use

http://en.wikipedia.org/wiki/Tf%E2%80%93idf
http://en.wikipedia.org/wiki/Jaccard_index

Find the best set overlap between the old page and the new page, provide top n results to user

  1. Edit distance between URLs

http://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance

  1. Site Search

The other issues entered against this are #14572 and #18300 for search specifically as a solution.

Put a search box on that 404 page and populate with url fragments.

If put through google, "type Option unwrap_or_else site:doc.rust-lang.org”

the first link finds that page,

In [6]: [ t for t in "type.Option.html#method.unwrap_or_else".split(".") if '#' not in t ]
Out[6]: ['type', 'Option', 'unwrap_or_else’]

@seanjensengrey
Copy link
Contributor Author

Is the doc.rust-lang.org site in VCS somewhere we could make the modifications ourselves?

@huonw
Copy link
Member

huonw commented Oct 31, 2014

It is generated by rustdoc which is in the main repository src/librustdoc, the standalone pages are in src/doc. I think this is a dupe of #14572 along with the autofilling suggestion there.

@seanjensengrey
Copy link
Contributor Author

Site search is just one solution. We could also redirect to the proper page automatically, #14572 was specifically about adding a search box. Originally I typed up this request before I found those two other issues. So a partial dupe?

Looks like the source to that page is

https://raw.githubusercontent.com/rust-lang/rust/master/src/doc/not_found.md

Maybe @steveklabnik could point us in the direction of the 404 handler for the site? A pure JS solution in the meantime?

@huonw
Copy link
Member

huonw commented Nov 1, 2014

I don't think automatic redirecting is a good solution. I think providing a list of possibilities is much better, which is exactly what an auto-filled search box will do. As with the normal doc search, this list of results can appear directly on the page, no user interaction necessary.

Maybe @steveklabnik could point us in the direction of the 404 handler for the site? A pure JS solution in the meantime?

The site is static, that page is literally just served as a plain HTML page for each 404, so yes, JS is required, e.g. the search infrastructure from rustdoc.

seanjensengrey added a commit to seanjensengrey/rust that referenced this issue Nov 2, 2014
This was referenced Nov 2, 2014
@seanjensengrey
Copy link
Contributor Author

Another piece of useful infrastructure is documentation specific search http://doc.rust-lang.org/core/?search=unwrap_or_else adding this functionality to #18528

bors added a commit that referenced this issue Nov 4, 2014
This addresses #18498 by adding a prepopulated search box to do site search on `doc.rust-lang.org` using duckduckgo AND generating a search url against the rust documentation using the internal search facilities.

* https://duckduckgo.com/?q=type+Option+unwrap_or_else+site%3Adoc.rust-lang.org
* http://doc.rust-lang.org/core/?search=unwrap_or_else
@seanjensengrey
Copy link
Contributor Author

This fix is live.

spikespaz pushed a commit to spikespaz/dotwalk-rs that referenced this issue Aug 29, 2024
This addresses rust-lang/rust#18498 by adding a prepopulated search box to do site search on `doc.rust-lang.org` using duckduckgo AND generating a search url against the rust documentation using the internal search facilities.

* https://duckduckgo.com/?q=type+Option+unwrap_or_else+site%3Adoc.rust-lang.org
* http://doc.rust-lang.org/core/?search=unwrap_or_else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants