fix(build): build error caused by non-exsisting readme
This commit is contained in:
parent
34c949d43f
commit
f2ceda77aa
|
|
@ -61,15 +61,21 @@ function CardCategory({item}) {
|
|||
if (!href) {
|
||||
return null;
|
||||
}
|
||||
const docId = href.substring(6) + 'README';
|
||||
const doc = useDocById(docId ?? undefined);
|
||||
const ReadMeSubfix = href.endsWith('/') ? 'README' : '/README';
|
||||
const docId = href.substring(6) + ReadMeSubfix;
|
||||
let doc;
|
||||
try {
|
||||
doc = useDocById(docId ?? undefined);
|
||||
} catch (e) {
|
||||
doc = null;
|
||||
}
|
||||
return (
|
||||
<CardLayout
|
||||
className={item.className}
|
||||
href={href}
|
||||
icon="🗃️"
|
||||
title={item.label}
|
||||
description={item.description ?? doc.description ?? categoryItemsPlural(item.items.length)}
|
||||
description={item.description ?? doc?.description ?? categoryItemsPlural(item.items.length)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue