diff --git a/src/components/site/PostToc.tsx b/src/components/site/PostToc.tsx index 8bcecd53..8a7d7d28 100644 --- a/src/components/site/PostToc.tsx +++ b/src/components/site/PostToc.tsx @@ -53,33 +53,36 @@ function renderItems(items: TocResult["map"], activeId: string, prefix = "") {
    {items?.children?.map((item, index) => (
  1. - {item.children.map((child: any, i) => ( - - {child.type === "paragraph" && child.children?.[0]?.url && ( - - {`${prefix}${index + 1}. ${ - child.children[0].children?.[0]?.value || - child.children[0].children?.[0]?.children?.[0]?.value - }`} - - )} - {child.type === "list" && - renderItems(child, activeId, `${index + 1}.`)} - - ))} + {item.children.map((child: any, i) => { + const content = + child.children[0].children?.[0]?.value || + child.children[0].children?.[0]?.children?.[0]?.value + return ( + + {child.type === "paragraph" && child.children?.[0]?.url && ( + + {`${prefix}${index + 1}. ${content}`} + + )} + {child.type === "list" && + renderItems(child, activeId, `${index + 1}.`)} + + ) + })}
  2. ))}