Skip to content

Commit d783477

Browse files
keep turbo working during 404 on cms (#1253)
1 parent a54d47c commit d783477

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

pgml-dashboard/src/api/cms.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,6 @@ pub struct Document {
3434
}
3535

3636
impl 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-
4837
pub async fn from_path(path: &PathBuf) -> anyhow::Result<Document, std::io::Error> {
4938
let 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(
320309
r#"
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

338327
Err(crate::responses::NotFound(layout.into()))
339328
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy