File tree 7 files changed +29
-23
lines changed
7 files changed +29
-23
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,10 @@ impl Blog {
111
111
& self . prefix
112
112
}
113
113
114
+ pub ( crate ) fn path_back_to_root ( & self ) -> PathBuf {
115
+ self . prefix . components ( ) . map ( |_| Path :: new ( "../" ) ) . collect ( )
116
+ }
117
+
114
118
pub ( crate ) fn posts ( & self ) -> & [ Post ] {
115
119
& self . posts
116
120
}
Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ impl<'a> Generator<'a> {
120
120
. map ( |other_blog| {
121
121
json ! ( {
122
122
"link_text" : other_blog. link_text( ) ,
123
- "url" : PathBuf :: from ( "/" ) . join ( other_blog. prefix( ) ) . join( "index.html" ) ,
123
+ "url" : other_blog. prefix( ) . join( "index.html" ) ,
124
124
} )
125
125
} )
126
126
. collect ( ) ;
@@ -130,6 +130,7 @@ impl<'a> Generator<'a> {
130
130
"parent" : "layout" ,
131
131
"blog" : blog,
132
132
"other_blogs" : other_blogs,
133
+ "root" : blog. path_back_to_root( ) ,
133
134
} ) ;
134
135
self . render_template ( blog. prefix ( ) . join ( "index.html" ) , "index" , data) ?;
135
136
Ok ( ( ) )
@@ -152,6 +153,7 @@ impl<'a> Generator<'a> {
152
153
"parent" : "layout" ,
153
154
"blog" : blog,
154
155
"post" : post,
156
+ "root" : blog. path_back_to_root( ) . join( "../../../" ) ,
155
157
} ) ;
156
158
157
159
self . render_template ( path. join ( filename) , & post. layout , data) ?;
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ $format-names: (
70
70
@function urls ($filename , $range , $extensions ) {
71
71
$urls : ();
72
72
@each $extension in $extensions {
73
- $url : url (' /fonts/#{$extension } /#{$filename } .#{$range } .#{$extension } ' );
73
+ $url : url (' .. /fonts/#{$extension } /#{$filename } .#{$range } .#{$extension } ' );
74
74
$format : format (map-get ($format-names , $extension ));
75
75
76
76
$urls : append ($urls , $url $format , comma );
Original file line number Diff line number Diff line change 22
22
<div class =" four columns mt3 mt0-l" >
23
23
<h4 >Social</h4 >
24
24
<div class =" flex flex-row flex-wrap" >
25
- <a href =" https://twitter.com/rustlang" target =" _blank" rel =" noopener" alt =" twitter link" ><img src =" / images/twitter.svg" alt =" twitter logo" title =" Twitter" /></a >
26
- <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 >
27
- <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 >
28
- <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 >
25
+ <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 >
26
+ <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 >
27
+ <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 >
28
+ <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 >
29
29
</div >
30
30
<h4 class =" mt4 mb3" >RSS</h4 >
31
31
<ul >
32
- <li ><a href =" / feed.xml" >Main Blog</a ></li >
33
- <li ><a href =" / inside-rust/feed.xml" >"Inside Rust" Blog</a ></li >
32
+ <li ><a href =" {{ root }} feed.xml" >Main Blog</a ></li >
33
+ <li ><a href =" {{ root }} inside-rust/feed.xml" >"Inside Rust" Blog</a ></li >
34
34
</ul >
35
35
</div >
36
36
43
43
</footer >
44
44
45
45
<!-- scripts -->
46
- <script src =" / scripts/highlight.js" ></script >
46
+ <script src =" {{ root }} scripts/highlight.js" ></script >
Original file line number Diff line number Diff line change 14
14
<meta property =" og:locale" content =" en_US" />
15
15
16
16
<!-- styles -->
17
- <link rel =" stylesheet" href =" / styles/vendor.css" />
18
- <link rel =" stylesheet" href =" / styles/fonts.css" />
19
- <link rel =" stylesheet" href =" / styles/app.css" />
20
- <link rel =" stylesheet" href =" / styles/highlight.css" />
17
+ <link rel =" stylesheet" href =" {{ root }} styles/vendor.css" />
18
+ <link rel =" stylesheet" href =" {{ root }} styles/fonts.css" />
19
+ <link rel =" stylesheet" href =" {{ root }} styles/app.css" />
20
+ <link rel =" stylesheet" href =" {{ root }} styles/highlight.css" />
21
21
22
22
<!-- favicon -->
23
- <link rel =" apple-touch-icon" sizes =" 180x180" href =" / images/apple-touch-icon.png" >
24
- <link rel =" icon" type =" image/png" sizes =" 16x16" href =" / images/favicon-16x16.png" >
25
- <link rel =" icon" type =" image/png" sizes =" 32x32" href =" / images/favicon-32x32.png" >
26
- <link rel =" icon" type =" image/svg+xml" href =" / images/favicon.svg" >
27
- <link rel =" manifest" href =" / images/site.webmanifest" >
28
- <link rel =" mask-icon" href =" / images/safari-pinned-tab.svg" color =" #5bbad5" >
23
+ <link rel =" apple-touch-icon" sizes =" 180x180" href =" {{ root }} images/apple-touch-icon.png" >
24
+ <link rel =" icon" type =" image/png" sizes =" 16x16" href =" {{ root }} images/favicon-16x16.png" >
25
+ <link rel =" icon" type =" image/png" sizes =" 32x32" href =" {{ root }} images/favicon-32x32.png" >
26
+ <link rel =" icon" type =" image/svg+xml" href =" {{ root }} images/favicon.svg" >
27
+ <link rel =" manifest" href =" {{ root }} images/site.webmanifest" >
28
+ <link rel =" mask-icon" href =" {{ root }} images/safari-pinned-tab.svg" color =" #5bbad5" >
29
29
<meta name =" msapplication-TileColor" content =" #00aba9" >
30
30
<meta name =" theme-color" content =" #ffffff" >
31
31
Original file line number Diff line number Diff line change 10
10
<p >
11
11
<b >See also:</b >
12
12
{{ #each other_blogs }}
13
- <a href =" {{ url }} " >{{ link_text }} </a >
13
+ <a href =" {{ ../root }}{{ url }} " >{{ link_text }} </a >
14
14
{{ /each }}
15
15
</p >
16
16
</div >
28
28
</tr >{{ /if }}
29
29
<tr >
30
30
<td class =" tr o-60 pr4 pr5-l bn" >{{ month_name month }} {{ day }} </td >
31
- <td class =" bn" ><a href =" / {{ ../blog.prefix }} {{url }} " >{{ title }} </a ></td >
31
+ <td class =" bn" ><a href =" {{ url }} " >{{ title }} </a ></td >
32
32
</tr >
33
33
{{ /each }}
34
34
</table >
Original file line number Diff line number Diff line change 1
1
<nav class =" flex flex-row justify-center justify-end-l items-center flex-wrap ph2 pl3-ns pr4-ns" >
2
2
<div class =" brand flex-auto w-100 w-auto-l self-start tc tl-l" >
3
- <a href =" / {{ blog.prefix }} " >
4
- <img class =" v-mid ml0-l" alt =" Rust Logo" src =" / images/rust-logo-blk.svg" >
3
+ <a href =" {{ root }} {{blog.prefix }} " >
4
+ <img class =" v-mid ml0-l" alt =" Rust Logo" src =" {{ root }} images/rust-logo-blk.svg" >
5
5
<span class =" dib ml1 ml0-l" >{{ blog.title }} </span >
6
6
</a >
7
7
</div >
You can’t perform that action at this time.
0 commit comments