Don't let robots index the print.html (#844)
This commit is contained in:
parent
ecfaed1e02
commit
5163c5ab75
|
@ -4,6 +4,10 @@
|
||||||
<!-- Book generated using mdBook -->
|
<!-- Book generated using mdBook -->
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>{{ title }}</title>
|
<title>{{ title }}</title>
|
||||||
|
{{#if is_print }}
|
||||||
|
<meta name="robots" content="noindex" />
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||||
<meta name="description" content="{{ description }}">
|
<meta name="description" content="{{ description }}">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
|
@ -415,6 +415,20 @@ fn theme_dir_overrides_work_correctly() {
|
||||||
dummy_book::assert_contains_strings(built_index, &["This is a modified index.hbs!"]);
|
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")]
|
#[cfg(feature = "search")]
|
||||||
mod search {
|
mod search {
|
||||||
extern crate serde_json;
|
extern crate serde_json;
|
||||||
|
|
Loading…
Reference in New Issue