--- import TableOfContentsList from "./TableOfContentsList.astro"; const parseFlag = (value) => { if (typeof value === "boolean") return value; if (typeof value === "string") { const normalized = value.trim().toLowerCase(); if (["true", "1", "yes", "y", "on"].includes(normalized)) return true; if (["false", "0", "no", "n", "off"].includes(normalized)) return false; } return false; }; const route = Astro.locals.starlightRoute ?? {}; const { toc } = route; const entryData = route.entry?.data ?? {}; const frontmatter = entryData.frontmatter ?? entryData; const enableNumbering = parseFlag(frontmatter.numberedHeadings); const filteredItems = (toc?.items ?? []).filter((item) => item.slug !== "_top"); const title = Astro.locals.t("tableOfContents.onThisPage"); --- { filteredItems.length > 0 && ( ) }