File tree 2 files changed +20
-5
lines changed
crates/rari-doc/src/pages
2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -261,6 +261,11 @@ pub fn build_doc(doc: &Doc) -> Result<BuiltDocy, DocError> {
261
261
262
262
let no_indexing =
263
263
doc. meta . slug == "MDN/Kitchensink" || doc. is_orphaned ( ) || doc. is_conflicting ( ) ;
264
+ let parents = if !doc. is_conflicting ( ) && !doc. is_orphaned ( ) {
265
+ parents ( doc)
266
+ } else {
267
+ Default :: default ( )
268
+ } ;
264
269
265
270
Ok ( BuiltDocy :: Doc ( Box :: new ( JsonDoADoc {
266
271
doc : JsonDoc {
@@ -272,7 +277,7 @@ pub fn build_doc(doc: &Doc) -> Result<BuiltDocy, DocError> {
272
277
is_translated : doc. meta . locale != Locale :: default ( ) ,
273
278
short_title,
274
279
is_active : true ,
275
- parents : parents ( doc ) ,
280
+ parents,
276
281
page_title : page_title ( doc, true ) ?,
277
282
body,
278
283
sidebar_html,
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ impl Doc {
111
111
}
112
112
113
113
pub fn is_conflicting ( & self ) -> bool {
114
- self . meta . slug . starts_with ( "orphaned /" )
114
+ self . meta . slug . starts_with ( "conflicting /" )
115
115
}
116
116
}
117
117
@@ -131,9 +131,19 @@ impl PageReader for Doc {
131
131
let mut doc = read_doc ( & path) ?;
132
132
133
133
if doc. meta . locale != Default :: default ( ) && !doc. is_conflicting ( ) && !doc. is_orphaned ( ) {
134
- let super_doc = Doc :: page_from_slug ( & doc. meta . slug , Default :: default ( ) ) ?;
135
- if let Page :: Doc ( super_doc) = super_doc {
136
- doc. copy_meta_from_super ( & super_doc) ;
134
+ match Doc :: page_from_slug ( & doc. meta . slug , Default :: default ( ) ) {
135
+ Ok ( Page :: Doc ( super_doc) ) => {
136
+ doc. copy_meta_from_super ( & super_doc) ;
137
+ }
138
+ Err ( DocError :: PageNotFound ( path, _) ) => {
139
+ tracing:: error!(
140
+ "Super doc not found for {}:{} (looked for {})" ,
141
+ doc. meta. locale. as_url_str( ) ,
142
+ doc. meta. slug,
143
+ path
144
+ ) ;
145
+ }
146
+ _ => { }
137
147
}
138
148
}
139
149
You can’t perform that action at this time.
0 commit comments