Skip to content

Commit 53db274

Browse files
committed
feat(spa): 404 spa
1 parent c955a66 commit 53db274

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

crates/rari-doc/src/pages/json.rs

+1
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ pub struct JsonBasicSPA {
296296
pub page_description: Option<&'static str>,
297297
pub only_follow: bool,
298298
pub no_indexing: bool,
299+
pub page_not_found: bool,
299300
pub url: String,
300301
}
301302

crates/rari-doc/src/pages/types/spa.rs

+19
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ pub struct BasicSPA {
3333
pub enum SPAData {
3434
BlogIndex,
3535
HomePage,
36+
NotFound,
3637
BasicSPA(BasicSPA),
3738
}
3839

@@ -138,6 +139,16 @@ impl SPA {
138139
page_description: self.page_description,
139140
only_follow: basic_spa.only_follow,
140141
no_indexing: basic_spa.no_indexing,
142+
page_not_found: false,
143+
url: concat_strs!(self.base_slug.as_ref(), self.slug),
144+
}))),
145+
SPAData::NotFound => Ok(BuiltDocy::BasicSPA(Box::new(JsonBasicSPA {
146+
slug: self.slug,
147+
page_title: self.page_title,
148+
page_description: self.page_description,
149+
only_follow: false,
150+
no_indexing: true,
151+
page_not_found: true,
141152
url: concat_strs!(self.base_slug.as_ref(), self.slug),
142153
}))),
143154
SPAData::HomePage => Ok(BuiltDocy::HomePageSPA(Box::new(JsonHomePageSPA {
@@ -281,6 +292,14 @@ static BASIC_SPAS: Map<&'static str, BuildSPA> = phf_map!(
281292
data: SPAData::HomePage,
282293
..DEFAULT_BASIC_SPA
283294
},
295+
"404" => BuildSPA {
296+
slug: "404",
297+
page_title: "404",
298+
page_description: None,
299+
trailing_slash: false,
300+
en_us_only: true,
301+
data: SPAData::NotFound
302+
},
284303
"blog" => BuildSPA {
285304
slug: "blog",
286305
page_title: "MDN Blog",

0 commit comments

Comments
 (0)