Skip to content

Commit a1e3904

Browse files
Add footer with link to the Policy page and to the Rust Foundation
1 parent 55c7386 commit a1e3904

File tree

7 files changed

+72
-2
lines changed

7 files changed

+72
-2
lines changed

templates/base.html

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
{%- block header %}{% endblock header -%}
3030

3131
{%- block body -%}{%- endblock body -%}
32+
{%- include "footer.html" -%}
3233

3334
<script type="text/javascript" nonce="{{ csp_nonce }}" src="/-/static/menu.js?{{ docsrs_version() | slugify }}"></script>
3435
<script type="text/javascript" nonce="{{ csp_nonce }}" src="/-/static/index.js?{{ docsrs_version() | slugify }}"></script>

templates/footer.html

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<div class="docs-rs-footer">
2+
<a href="https://foundation.rust-lang.org/policies/privacy-policy/#docs.rs">Privacy policy</a>
3+
<a href="https://foundation.rust-lang.org/">Rust Foundation</a>
4+
</div>

templates/rustdoc/body.html

+1
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@
3333

3434
{# see comment in ../../static/storage-change-detection.html for details #}
3535
<iframe src="/-/static/storage-change-detection.html" width="0" height="0" style="display: none"></iframe>
36+
{%- include "footer.html" -%}

templates/style/_vars.scss

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ $font-family-mono: "Source Code Pro", Menlo, Monaco, Consolas, "DejaVu Sans Mono
77

88
// Sizes
99
$top-navbar-height: 32px; // height of the floating top navbar
10+
$footer-height: 30px; // height of the floating footer
1011

1112
// Pure compatible media queries
1213
// usage:

templates/style/base.scss

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// FIXME: Use modules
2-
@import "vars", "utils", "navbar", "themes", "fa";
2+
@import "vars", "utils", "navbar", "themes", "fa", "footer";
33

44
/* See FiraSans-LICENSE.txt for the Fira Sans license. */
55
@font-face {
@@ -74,6 +74,7 @@ textarea,
7474
body {
7575
padding: 0;
7676
margin: 0;
77+
min-height: calc(100vh - $top-navbar-height - $footer-height);
7778

7879
* {
7980
-webkit-box-sizing: border-box;

templates/style/footer.scss

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
@import "vars";
2+
3+
.docs-rs-footer {
4+
position: absolute;
5+
bottom: 0;
6+
right: 0;
7+
width: 100%;
8+
text-align: center;
9+
font-size: 0.9em;
10+
height: $footer-height;
11+
background: var(--color-background);
12+
border-top: 1px solid var(--color-border);
13+
14+
> a {
15+
font-weight: 400;
16+
border-right: 1px solid var(--color-border);
17+
padding: 4px 8px;
18+
height: 100%;
19+
display: inline-block;
20+
color: var(--color-navbar-standard);
21+
22+
&:hover {
23+
color: var(--color-standard);
24+
}
25+
&:first-child {
26+
border-left: 1px solid var(--color-border);
27+
}
28+
}
29+
}

templates/style/rustdoc.scss

+34-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
// FIXME: Use modules
2-
@import "vars", "navbar", "themes", "fa";
2+
@import "vars", "navbar", "themes", "fa", "footer";
3+
4+
// This rule is needed to be sure that the footer will always be at the bottom of the page.
5+
body.rustdoc-page {
6+
min-height: 100vh;
7+
}
38

49
// Force the navbar to be left-aligned on rustdoc pages
510
body.rustdoc-page > .nav-container > .container {
@@ -8,6 +13,34 @@ body.rustdoc-page > .nav-container > .container {
813

914
div.container-rustdoc {
1015
text-align: left;
16+
17+
> .docs-rs-footer {
18+
bottom: -20px;
19+
}
20+
}
21+
22+
div.container-rustdoc:not(.source) {
23+
> .docs-rs-footer {
24+
right: -15px;
25+
width: calc(100vw - 212px);
26+
}
27+
28+
// This is when the rustdoc sidebar "disappears" (for mobile mode).
29+
@media (max-width: 700px) {
30+
> .docs-rs-footer:not(.source) {
31+
width: 100vw;
32+
}
33+
}
34+
}
35+
36+
div.container-rustdoc.source {
37+
> .docs-rs-footer {
38+
width: 100vw;
39+
left: -15px;
40+
// This is needed because even though the sidebar only contains the header, it still takes
41+
// all the height.
42+
z-index: 1;
43+
}
1144
}
1245

1346
// this is a super nasty override for help dialog in rustdocs

0 commit comments

Comments
 (0)