Skip to content

Commit a353b88

Browse files
committed
fix(build): orphaned and conflicting
1 parent 675a738 commit a353b88

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

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

+6-1
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,11 @@ pub fn build_doc(doc: &Doc) -> Result<BuiltDocy, DocError> {
261261

262262
let no_indexing =
263263
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+
};
264269

265270
Ok(BuiltDocy::Doc(Box::new(JsonDoADoc {
266271
doc: JsonDoc {
@@ -272,7 +277,7 @@ pub fn build_doc(doc: &Doc) -> Result<BuiltDocy, DocError> {
272277
is_translated: doc.meta.locale != Locale::default(),
273278
short_title,
274279
is_active: true,
275-
parents: parents(doc),
280+
parents,
276281
page_title: page_title(doc, true)?,
277282
body,
278283
sidebar_html,

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

+14-4
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl Doc {
111111
}
112112

113113
pub fn is_conflicting(&self) -> bool {
114-
self.meta.slug.starts_with("orphaned/")
114+
self.meta.slug.starts_with("conflicting/")
115115
}
116116
}
117117

@@ -131,9 +131,19 @@ impl PageReader for Doc {
131131
let mut doc = read_doc(&path)?;
132132

133133
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+
_ => {}
137147
}
138148
}
139149

0 commit comments

Comments
 (0)