@@ -139,25 +139,28 @@ impl Generator {
139
139
}
140
140
141
141
fn render_post ( & self , blog : & Blog , post : & Post ) -> eyre:: Result < PathBuf > {
142
+ let mut filename = PathBuf :: from ( & post. filename ) ;
143
+ filename. set_extension ( "html" ) ;
144
+
145
+ // This directory path is a compatiblity thing with a planned migration
146
+ // to Zola. Zola insists on rendering pages at ../index.html, but we
147
+ // mustn't break existing permalinks. So, ../slug.html/index.html it is.
142
148
let path = blog
143
149
. path ( )
144
150
. join ( format ! ( "{:04}" , & post. year) )
145
151
. join ( format ! ( "{:02}" , & post. month) )
146
- . join ( format ! ( "{:02}" , & post. day) ) ;
152
+ . join ( format ! ( "{:02}" , & post. day) )
153
+ . join ( filename) ;
147
154
fs:: create_dir_all ( self . out_directory . join ( & path) ) ?;
148
155
149
- // then, we render the page in that path
150
- let mut filename = PathBuf :: from ( & post. filename ) ;
151
- filename. set_extension ( "html" ) ;
152
-
153
156
let data = json ! ( {
154
157
"title" : format!( "{} | {}" , post. title, blog. title( ) ) ,
155
158
"section" : blog,
156
159
"page" : post,
157
- "root" : blog. path_back_to_root( ) . join( "../../../" ) ,
160
+ "root" : blog. path_back_to_root( ) . join( "../../../../ " ) ,
158
161
} ) ;
159
162
160
- let path = path. join ( filename ) ;
163
+ let path = path. join ( "index.html" ) ;
161
164
self . render_template ( & path, & format ! ( "{}.html" , post. layout) , data) ?;
162
165
Ok ( path)
163
166
}
0 commit comments