@@ -34,17 +34,6 @@ pub struct Document {
3434}
3535
3636impl Document {
37- pub fn new ( content : & str ) ->Document {
38- Document {
39- path : PathBuf :: new ( ) ,
40- description : None ,
41- image : None ,
42- title : "404" . to_string ( ) ,
43- toc_links : Vec :: new ( ) ,
44- html : content. to_string ( ) ,
45- }
46- }
47-
4837pub async fn from_path ( path : & PathBuf ) -> anyhow:: Result < Document , std:: io:: Error > {
4938let contents = tokio:: fs:: read_to_string ( & path) . await ?;
5039
@@ -314,9 +303,9 @@ impl Collection {
314303}
315304// Return page not found on bad path
316305 _ =>{
317- let mut layout =crate :: templates:: Layout :: new ( "404" , None ) ;
306+ let mut layout =crate :: templates:: Layout :: new ( "404" , Some ( cluster ) ) ;
318307
319- let doc =crate :: api :: cms :: Document :: new (
308+ let doc =String :: from (
320309r#"
321310 <div style='height: 80vh'>
322311 <h2>Oops, document not found!</h2>
@@ -333,7 +322,7 @@ impl Collection {
333322. nav_title ( & self . name )
334323. footer ( cluster. context . marketing_footer . to_string ( ) ) ;
335324
336- layout. render ( crate :: templates:: Article { content : doc. html } ) ;
325+ layout. render ( crate :: templates:: Article { content : doc} ) ;
337326
338327Err ( crate :: responses:: NotFound ( layout. into ( ) ) )
339328}