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

Don't let robots index the print.html #844

Merged
merged 1 commit into from May 7, 2019
Merged
Changes from all commits
Commits
File filter
Filter file types
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -4,6 +4,10 @@
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>{{ title }}</title>
{{#if is_print }}
<meta name="robots" content="noindex" />
{{/if}}

<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="description" content="{{ description }}">
<meta name="viewport" content="width=device-width, initial-scale=1">
@@ -397,6 +397,20 @@ fn theme_dir_overrides_work_correctly() {
dummy_book::assert_contains_strings(built_index, &["This is a modified index.hbs!"]);
}


#[test]
fn no_index_for_print_html() {
let temp = DummyBook::new().build().unwrap();
let md = MDBook::load(temp.path()).unwrap();
md.build().unwrap();

let print_html = temp.path().join("book/print.html");
assert_contains_strings(print_html, &[r##"noindex"##]);

let index_html = temp.path().join("book/index.html");
assert_doesnt_contain_strings(index_html, &[r##"noindex"##]);
}

#[cfg(feature = "search")]
mod search {
extern crate serde_json;