parent
2b0a15494a
commit
57e53d5c2f
2 changed files with 16 additions and 1 deletions
|
@ -26,7 +26,8 @@ pub struct Page<'a> {
|
||||||
pub title: &'a str,
|
pub title: &'a str,
|
||||||
pub ty: &'a str,
|
pub ty: &'a str,
|
||||||
pub root_path: &'a str,
|
pub root_path: &'a str,
|
||||||
pub description: &'a str
|
pub description: &'a str,
|
||||||
|
pub keywords: &'a str
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn render<T: fmt::Show, S: fmt::Show>(
|
pub fn render<T: fmt::Show, S: fmt::Show>(
|
||||||
|
@ -41,6 +42,7 @@ r##"<!DOCTYPE html>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta name="generator" content="rustdoc">
|
<meta name="generator" content="rustdoc">
|
||||||
<meta name="description" content="{description}">
|
<meta name="description" content="{description}">
|
||||||
|
<meta name="keywords" content="{keywords}">
|
||||||
|
|
||||||
<title>{title}</title>
|
<title>{title}</title>
|
||||||
|
|
||||||
|
@ -137,6 +139,7 @@ r##"<!DOCTYPE html>
|
||||||
},
|
},
|
||||||
title = page.title,
|
title = page.title,
|
||||||
description = page.description,
|
description = page.description,
|
||||||
|
keywords = page.keywords,
|
||||||
favicon = if layout.favicon.len() == 0 {
|
favicon = if layout.favicon.len() == 0 {
|
||||||
"".to_string()
|
"".to_string()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -748,6 +748,7 @@ impl<'a> SourceCollector<'a> {
|
||||||
ty: "source",
|
ty: "source",
|
||||||
root_path: root_path.as_slice(),
|
root_path: root_path.as_slice(),
|
||||||
description: desc.as_slice(),
|
description: desc.as_slice(),
|
||||||
|
keywords: get_basic_keywords(),
|
||||||
};
|
};
|
||||||
try!(layout::render(&mut w as &mut Writer, &self.cx.layout,
|
try!(layout::render(&mut w as &mut Writer, &self.cx.layout,
|
||||||
&page, &(""), &Source(contents)));
|
&page, &(""), &Source(contents)));
|
||||||
|
@ -1081,6 +1082,7 @@ impl Context {
|
||||||
root_path: this.root_path.as_slice(),
|
root_path: this.root_path.as_slice(),
|
||||||
title: title.as_slice(),
|
title: title.as_slice(),
|
||||||
description: desc.as_slice(),
|
description: desc.as_slice(),
|
||||||
|
keywords: get_basic_keywords(),
|
||||||
};
|
};
|
||||||
let html_dst = &this.dst.join("stability.html");
|
let html_dst = &this.dst.join("stability.html");
|
||||||
let mut html_out = BufferedWriter::new(try!(File::create(html_dst)));
|
let mut html_out = BufferedWriter::new(try!(File::create(html_dst)));
|
||||||
|
@ -1137,11 +1139,13 @@ impl Context {
|
||||||
format!("API documentation for the Rust `{}` {} in crate `{}`.",
|
format!("API documentation for the Rust `{}` {} in crate `{}`.",
|
||||||
it.name.get_ref(), tyname, cx.layout.krate)
|
it.name.get_ref(), tyname, cx.layout.krate)
|
||||||
};
|
};
|
||||||
|
let keywords = make_item_keywords(it);
|
||||||
let page = layout::Page {
|
let page = layout::Page {
|
||||||
ty: tyname,
|
ty: tyname,
|
||||||
root_path: cx.root_path.as_slice(),
|
root_path: cx.root_path.as_slice(),
|
||||||
title: title.as_slice(),
|
title: title.as_slice(),
|
||||||
description: desc.as_slice(),
|
description: desc.as_slice(),
|
||||||
|
keywords: keywords.as_slice(),
|
||||||
};
|
};
|
||||||
|
|
||||||
markdown::reset_headers();
|
markdown::reset_headers();
|
||||||
|
@ -2170,3 +2174,11 @@ fn ignore_private_item(it: &clean::Item) -> bool {
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_basic_keywords() -> &'static str {
|
||||||
|
"rust, rustlang, rust-lang"
|
||||||
|
}
|
||||||
|
|
||||||
|
fn make_item_keywords(it: &clean::Item) -> String {
|
||||||
|
format!("{}, {}", get_basic_keywords(), it.name.get_ref())
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue