Skip to content

Commit

Permalink
feat(spa): 404 spa
Browse files Browse the repository at this point in the history
  • Loading branch information
fiji-flo committed Oct 18, 2024
1 parent c955a66 commit 53db274
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/rari-doc/src/pages/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ pub struct JsonBasicSPA {
pub page_description: Option<&'static str>,
pub only_follow: bool,
pub no_indexing: bool,
pub page_not_found: bool,
pub url: String,
}

Expand Down
19 changes: 19 additions & 0 deletions crates/rari-doc/src/pages/types/spa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub struct BasicSPA {
pub enum SPAData {
BlogIndex,
HomePage,
NotFound,
BasicSPA(BasicSPA),
}

Expand Down Expand Up @@ -138,6 +139,16 @@ impl SPA {
page_description: self.page_description,
only_follow: basic_spa.only_follow,
no_indexing: basic_spa.no_indexing,
page_not_found: false,
url: concat_strs!(self.base_slug.as_ref(), self.slug),
}))),
SPAData::NotFound => Ok(BuiltDocy::BasicSPA(Box::new(JsonBasicSPA {
slug: self.slug,
page_title: self.page_title,
page_description: self.page_description,
only_follow: false,
no_indexing: true,
page_not_found: true,
url: concat_strs!(self.base_slug.as_ref(), self.slug),
}))),
SPAData::HomePage => Ok(BuiltDocy::HomePageSPA(Box::new(JsonHomePageSPA {
Expand Down Expand Up @@ -281,6 +292,14 @@ static BASIC_SPAS: Map<&'static str, BuildSPA> = phf_map!(
data: SPAData::HomePage,
..DEFAULT_BASIC_SPA
},
"404" => BuildSPA {
slug: "404",
page_title: "404",
page_description: None,
trailing_slash: false,
en_us_only: true,
data: SPAData::NotFound
},
"blog" => BuildSPA {
slug: "blog",
page_title: "MDN Blog",
Expand Down

0 comments on commit 53db274

Please sign in to comment.