Skip to content

Commit a01fc33

Browse files
committed
---
yaml --- r: 154091 b: refs/heads/try2 c: 57e53d5 h: refs/heads/master i: 154089: a06088c 154087: f9bf375 v: v3
1 parent 30ae509 commit a01fc33

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 2b0a15494ae24f7f131c8cbe14ca00638b1ae5f9
8+
refs/heads/try2: 57e53d5c2f761a09c1d37d54dd93dc7109b329ab
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustdoc/html/layout.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ pub struct Page<'a> {
2626
pub title: &'a str,
2727
pub ty: &'a str,
2828
pub root_path: &'a str,
29-
pub description: &'a str
29+
pub description: &'a str,
30+
pub keywords: &'a str
3031
}
3132

3233
pub fn render<T: fmt::Show, S: fmt::Show>(
@@ -41,6 +42,7 @@ r##"<!DOCTYPE html>
4142
<meta name="viewport" content="width=device-width, initial-scale=1.0">
4243
<meta name="generator" content="rustdoc">
4344
<meta name="description" content="{description}">
45+
<meta name="keywords" content="{keywords}">
4446
4547
<title>{title}</title>
4648
@@ -137,6 +139,7 @@ r##"<!DOCTYPE html>
137139
},
138140
title = page.title,
139141
description = page.description,
142+
keywords = page.keywords,
140143
favicon = if layout.favicon.len() == 0 {
141144
"".to_string()
142145
} else {

branches/try2/src/librustdoc/html/render.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,7 @@ impl<'a> SourceCollector<'a> {
748748
ty: "source",
749749
root_path: root_path.as_slice(),
750750
description: desc.as_slice(),
751+
keywords: get_basic_keywords(),
751752
};
752753
try!(layout::render(&mut w as &mut Writer, &self.cx.layout,
753754
&page, &(""), &Source(contents)));
@@ -1081,6 +1082,7 @@ impl Context {
10811082
root_path: this.root_path.as_slice(),
10821083
title: title.as_slice(),
10831084
description: desc.as_slice(),
1085+
keywords: get_basic_keywords(),
10841086
};
10851087
let html_dst = &this.dst.join("stability.html");
10861088
let mut html_out = BufferedWriter::new(try!(File::create(html_dst)));
@@ -1137,11 +1139,13 @@ impl Context {
11371139
format!("API documentation for the Rust `{}` {} in crate `{}`.",
11381140
it.name.get_ref(), tyname, cx.layout.krate)
11391141
};
1142+
let keywords = make_item_keywords(it);
11401143
let page = layout::Page {
11411144
ty: tyname,
11421145
root_path: cx.root_path.as_slice(),
11431146
title: title.as_slice(),
11441147
description: desc.as_slice(),
1148+
keywords: keywords.as_slice(),
11451149
};
11461150

11471151
markdown::reset_headers();
@@ -2170,3 +2174,11 @@ fn ignore_private_item(it: &clean::Item) -> bool {
21702174
_ => false,
21712175
}
21722176
}
2177+
2178+
fn get_basic_keywords() -> &'static str {
2179+
"rust, rustlang, rust-lang"
2180+
}
2181+
2182+
fn make_item_keywords(it: &clean::Item) -> String {
2183+
format!("{}, {}", get_basic_keywords(), it.name.get_ref())
2184+
}

0 commit comments

Comments
 (0)