Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f057363

Browse filesBrowse files
committed
Remove unneeded 'root' variable from templates
1 parent 6fd3df1 commit f057363
Copy full SHA for f057363

File tree

Expand file treeCollapse file tree

7 files changed

+30
-36
lines changed
Filter options
Expand file treeCollapse file tree

7 files changed

+30
-36
lines changed

‎src/blogs.rs

Copy file name to clipboardExpand all lines: src/blogs.rs
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,6 @@ impl Blog {
110110
&self.prefix
111111
}
112112

113-
pub(crate) fn path_back_to_root(&self) -> PathBuf {
114-
self.prefix.components().map(|_| Path::new("../")).collect()
115-
}
116-
117113
pub(crate) fn posts(&self) -> &[Post] {
118114
&self.posts
119115
}

‎src/lib.rs

Copy file name to clipboardExpand all lines: src/lib.rs
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ impl Generator {
186186
"title": blog.index_title(),
187187
"blog": blog,
188188
"other_blogs": other_blogs,
189-
"root": blog.path_back_to_root(),
190189
});
191190
let path = blog.prefix().join("index.html");
192191
self.render_template(&path, "index.html", data)?;
@@ -209,7 +208,6 @@ impl Generator {
209208
"title": format!("{} | {}", post.title, blog.title()),
210209
"blog": blog,
211210
"post": post,
212-
"root": blog.path_back_to_root().join("../../../"),
213211
});
214212

215213
let path = path.join(filename);

‎templates/footer.html

Copy file name to clipboardExpand all lines: templates/footer.html
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% macro footer(root) -%}
1+
{% macro footer() -%}
22
<footer>
33
<div class="w-100 mw-none ph3 mw8-m mw9-l center f3">
44
<div class="row">
@@ -22,16 +22,16 @@ <h4>Terms and policies</h4>
2222
<div class="four columns mt3 mt0-l">
2323
<h4>Social</h4>
2424
<div class="flex flex-row flex-wrap">
25-
<a rel="me" href="https://social.rust-lang.org/@rust" target="_blank" rel="noopener" alt="mastodon link"><img src="{{root}}images/mastodon.svg" alt="mastodon logo" title="Mastodon"/></a>
26-
<a href="https://twitter.com/rustlang" target="_blank" rel="noopener" alt="twitter link"><img src="{{root}}images/twitter.svg" alt="twitter logo" title="Twitter"/></a>
27-
<a href="https://www.youtube.com/channel/UCaYhcUwRBNscFNUKTjgPFiA" target="_blank" rel="noopener" alt="youtube link"><img style="padding-top: 6px; padding-bottom:6px" src="{{root}}images/youtube.svg" alt="youtube logo" title="YouTube"/></a>
28-
<a href="https://discord.gg/rust-lang" target="_blank" rel="noopener" alt="discord link"><img src="{{root}}images/discord.svg" alt="discord logo" title="Discord"/></a>
29-
<a href="https://github.com/rust-lang" target="_blank" rel="noopener" alt="github link"><img src="{{root}}images/github.svg" alt="github logo" title="GitHub"/></a>
25+
<a rel="me" href="https://social.rust-lang.org/@rust" target="_blank" rel="noopener" alt="mastodon link"><img src="/images/mastodon.svg" alt="mastodon logo" title="Mastodon"/></a>
26+
<a href="https://twitter.com/rustlang" target="_blank" rel="noopener" alt="twitter link"><img src="/images/twitter.svg" alt="twitter logo" title="Twitter"/></a>
27+
<a href="https://www.youtube.com/channel/UCaYhcUwRBNscFNUKTjgPFiA" target="_blank" rel="noopener" alt="youtube link"><img style="padding-top: 6px; padding-bottom:6px" src="/images/youtube.svg" alt="youtube logo" title="YouTube"/></a>
28+
<a href="https://discord.gg/rust-lang" target="_blank" rel="noopener" alt="discord link"><img src="/images/discord.svg" alt="discord logo" title="Discord"/></a>
29+
<a href="https://github.com/rust-lang" target="_blank" rel="noopener" alt="github link"><img src="/images/github.svg" alt="github logo" title="GitHub"/></a>
3030
</div>
3131
<h4 class="mt4 mb3">RSS</h4>
3232
<ul>
33-
<li><a href="{{root}}feed.xml">Main Blog</a></li>
34-
<li><a href="{{root}}inside-rust/feed.xml">"Inside Rust" Blog</a></li>
33+
<li><a href="/feed.xml">Main Blog</a></li>
34+
<li><a href="/inside-rust/feed.xml">"Inside Rust" Blog</a></li>
3535
</ul>
3636
</div>
3737

@@ -44,5 +44,5 @@ <h4 class="mt4 mb3">RSS</h4>
4444
</footer>
4545

4646
<!-- scripts -->
47-
<script src="{{root}}scripts/highlight.js"></script>
47+
<script src="/scripts/highlight.js"></script>
4848
{% endmacro %}

‎templates/headers.html

Copy file name to clipboard
+13-13Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% macro headers(root, title, blog) -%}
1+
{% macro headers(title, blog) -%}
22
<!-- Twitter card -->
33
<meta name="twitter:card" content="summary">
44
<meta name="twitter:site" content="@rustlang">
@@ -15,29 +15,29 @@
1515
<meta property="og:locale" content="en_US" />
1616

1717
<!-- styles -->
18-
<link rel="stylesheet" href="{{root}}styles/vendor.css"/>
19-
<link rel="stylesheet" href="{{root}}styles/fonts.css"/>
20-
<link rel="stylesheet" href="{{root}}styles/app.css"/>
21-
<link rel="stylesheet" href="{{root}}styles/highlight.css"/>
18+
<link rel="stylesheet" href="/styles/vendor.css"/>
19+
<link rel="stylesheet" href="/styles/fonts.css"/>
20+
<link rel="stylesheet" href="/styles/app.css"/>
21+
<link rel="stylesheet" href="/styles/highlight.css"/>
2222

2323
<!-- stylesheet for user agents without js -->
2424
<noscript>
25-
<link rel="stylesheet" href="{{root}}styles/noscript.css">
25+
<link rel="stylesheet" href="/styles/noscript.css">
2626
</noscript>
2727

2828
<!-- favicon -->
29-
<link rel="apple-touch-icon" sizes="180x180" href="{{root}}images/apple-touch-icon.png">
30-
<link rel="icon" type="image/png" sizes="16x16" href="{{root}}images/favicon-16x16.png">
31-
<link rel="icon" type="image/png" sizes="32x32" href="{{root}}images/favicon-32x32.png">
32-
<link rel="icon" type="image/svg+xml" href="{{root}}images/favicon.svg">
33-
<link rel="manifest" href="{{root}}images/site.webmanifest">
34-
<link rel="mask-icon" href="{{root}}images/safari-pinned-tab.svg" color="#5bbad5">
29+
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png">
30+
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.png">
31+
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.png">
32+
<link rel="icon" type="image/svg+xml" href="/images/favicon.svg">
33+
<link rel="manifest" href="/images/site.webmanifest">
34+
<link rel="mask-icon" href="/images/safari-pinned-tab.svg" color="#5bbad5">
3535
<meta name="msapplication-TileColor" content="#00aba9">
3636
<meta name="theme-color" content="#ffffff">
3737

3838
<!-- atom -->
3939
<link type="application/atom+xml" rel="alternate" href="https://blog.rust-lang.org/{{blog.prefix}}feed.xml" title="{{blog.title}}" />
4040

4141
<!-- theme switcher -->
42-
<script src="{{root}}scripts/theme-switch.js"></script>
42+
<script src="/scripts/theme-switch.js"></script>
4343
{% endmacro %}

‎templates/index.html

Copy file name to clipboardExpand all lines: templates/index.html
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<p>
1212
<b>See also:</b>
1313
{%- for other in other_blogs %}
14-
<a href="{{root}}{{other.url}}">{{other.link_text | escape_hbs}}</a>
14+
<a href="/{{other.url}}">{{other.link_text | escape_hbs}}</a>
1515
{%- endfor %}
1616
</p>
1717
</div>

‎templates/layout.html

Copy file name to clipboardExpand all lines: templates/layout.html
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
<title>{{ title | escape_hbs }}</title>
99
<meta name="viewport" content="width=device-width,initial-scale=1.0">
1010
<meta name="description" content="Empowering everyone to build reliable and efficient software.">
11-
{{ headers::headers(root=root, title=title, blog=blog) | indent(prefix=" ", blank=true) }}
11+
{{ headers::headers(title=title, blog=blog) | indent(prefix=" ", blank=true) }}
1212
</head>
1313
<body>
14-
{{ nav::nav(root=root, blog=blog) | indent(prefix=" ", blank=true) }}
14+
{{ nav::nav(blog=blog) | indent(prefix=" ", blank=true) }}
1515
{%- block page %}{% endblock page %}
16-
{{ footer::footer(root=root) | indent(prefix=" ", blank=true) }}
16+
{{ footer::footer() | indent(prefix=" ", blank=true) }}
1717
</body>
1818
</html>

‎templates/nav.html

Copy file name to clipboardExpand all lines: templates/nav.html
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
{% macro nav(root, blog) -%}
1+
{% macro nav(blog) -%}
22
<nav class="flex flex-row justify-center justify-end-l items-center flex-wrap ph2 pl3-ns pr4-ns">
33
<div class="brand flex-auto w-100 w-auto-l self-start tc tl-l">
4-
<a href="{{root}}{{blog.prefix}}">
5-
<img class="v-mid ml0-l rust-logo" alt="Rust Logo" src="{{root}}images/rust-logo-blk.svg">
4+
<a href="/{{blog.prefix}}">
5+
<img class="v-mid ml0-l rust-logo" alt="Rust Logo" src="/images/rust-logo-blk.svg">
66
<span class="dib ml1 ml0-l">{{blog.title}}</span>
77
</a>
88
</div>
@@ -21,7 +21,7 @@
2121
<li class="theme-item" onclick="changeThemeTo('system');">System</li>
2222
</ul>
2323
</button>
24-
<script src="{{root}}scripts/theme-switch-post.js"></script>
24+
<script src="/scripts/theme-switch-post.js"></script>
2525
</ul>
2626
</nav>
2727
{% endmacro %}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.