Skip to content

Commit 166f9b9

Browse files
jshasyphar
authored andcommitted
Add canonical URL to crate builds page
1 parent 5631ef0 commit 166f9b9

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/web/builds.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ struct BuildsPage {
2727
metadata: MetaData,
2828
builds: Vec<Build>,
2929
limits: Limits,
30+
canonical_url: String,
3031
}
3132

3233
impl_webpage! {
@@ -118,6 +119,7 @@ pub fn build_list_handler(req: &mut Request) -> IronResult<Response> {
118119
),
119120
builds,
120121
limits,
122+
canonical_url: format!("https://docs.rs/crate/{}/latest/builds", name),
121123
}
122124
.into_response(req)
123125
}

templates/crate/builds.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
{{ macros::doc_title(name=metadata.name, version=metadata.version) }}
66
{%- endblock title -%}
77

8+
{%- block meta -%}
9+
<link rel="canonical" href="{{ canonical_url | safe }}" />
10+
{%- endblock -%}
11+
812
{%- block topbar -%}
913
{%- set latest_version = "" -%}
1014
{%- set latest_path = "" -%}

0 commit comments

Comments
 (0)