Skip to content

Purge the first edition stubs from search engines #1788

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

Merged
merged 2 commits into from
Feb 24, 2019

Conversation

kornelski
Copy link
Contributor

@kornelski kornelski commented Jan 27, 2019

Apparently this is still an annoying problem for users: https://users.rust-lang.org/t/why-are-links-to-the-old-book-still-floating-around/24656

This adds <meta name="robots" content="noindex,follow"> to first edition's pages in order to remove them from search engines.

To do that I had to copy the whole index.hbs and update move the theme directory to location required by the current mdBook version.

@kornelski
Copy link
Contributor Author

kornelski commented Feb 6, 2019

Regarding requirements mentioned in #1800

  • it has to work well with docs offline as well as online — it does, browsers ignore the robots meta.
  • offline docs cannot use a local web server — yes, it's just static HTML change.
  • the contents of older doc versions cannot be modified — that's unfortunate, but it does stop the problem from being perpetuated in newer releases.

Copy link
Member

@steveklabnik steveklabnik left a comment

Choose a reason for hiding this comment

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

To do that I had to copy the whole index.hbs and update move the theme directory to location required by the current mdBook version.

This is a bit unfortunate, but we can live with it.

Thanks for this! I have the question about 0.1 vs 0.2. Could you also do this for the second edition as well, please? Thank you!

@kornelski
Copy link
Contributor Author

I've changed the approach. I've removed the unnecessary upgrade to mdbook, and complex index template.

It's now a minimal template, and specifically for mdbook 0.1.7 used by this book.

@kornelski
Copy link
Contributor Author

I can make another PR for mdbook upgrade if you're interested.

@carols10cents
Copy link
Member

Could you also do this for the second edition as well, please? Thank you!

Triage: Looks like second-edition still needs to be done as Steve requested. IMO, this also should be done for 2018-edition, so that the top level src is the only edition that gets indexed.

@kornelski
Copy link
Contributor Author

I've copied the change to second-edition and 2018-edition.

@carols10cents carols10cents dismissed steveklabnik’s stale review February 24, 2019 17:06

Changes requested have been made

Copy link
Member

@carols10cents carols10cents left a comment

Choose a reason for hiding this comment

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

Ok, let's give this a try! Note that the book rides the release trains, so this will take time to get to doc.rust-lang.org/stable.

@carols10cents carols10cents merged commit ac6e4a0 into rust-lang:master Feb 24, 2019
@kornelski kornelski deleted the noindex branch February 24, 2019 17:41
@kornelski
Copy link
Contributor Author

Thanks @carols10cents I'll try to get it on stable ASAP. #1832

bors added a commit to rust-lang/rust that referenced this pull request Feb 27, 2019
Update book submodule

Updates the book to the latest commit

This is to include [documentation SEO fix](rust-lang/book#1788) ASAP.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Mar 26, 2019
Exclude old book redirect stubs from search engines

Adds `<meta name="robots" content="noindex,follow">` to the `<head>` of old stub pages pointing to the second edition of the book.

This is continuation of rust-lang/book#1788
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants