File tree Expand file tree Collapse file tree 5 files changed +19
-0
lines changed
renderer/render_404/explicitly_defined Expand file tree Collapse file tree 5 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -280,3 +280,18 @@ fn render_404_with_custom_content() {
280280 str![ "<p>I'm using contents in 404.md!</p>" ] ,
281281 ) ;
282282}
283+
284+ /// Render a 404 error page with custom content provided by the file declared by output.html.input-404 in `book.toml`.
285+ /// This produces a 404 error page with the custom file name provided in the `input-404` field.
286+ #[ test]
287+ fn render_404_from_custom_declared_file ( ) {
288+ let mut test = BookTest :: from_dir ( "renderer/render_404/explicitly_defined" ) ;
289+ test. check_main_file (
290+ "book/custom_404_filename.html" ,
291+ str![ "<p>This is my 404 content in custom_404_filename.md</p>" ] ,
292+ ) ;
293+
294+ // Check that the custom 404.md file present is not used or copied to the book output directory.
295+ assert ! ( test. dir. join( "src/404.md" ) . exists( ) ) ;
296+ assert ! ( !test. dir. join( "book/404.html" ) . exists( ) ) ;
297+ }
Original file line number Diff line number Diff line change 1+ [output .html ]
2+ input-404 = " custom_404_filename.md"
Original file line number Diff line number Diff line change 1+ I'm using contents in 404.md!
Original file line number Diff line number Diff line change 1+ This is my 404 content in custom_404_filename.md
You can’t perform that action at this time.
0 commit comments