Skip to content

Commit 9f15699

Browse files
authored
feat: filter out premium TOC file during processing (#667)
- Added a temporary filter to exclude "TOC-tidb-cloud-premium.md" from the TOC nodes, ensuring that premium content is not displayed until it is publicly available. This change enhances the content management process while maintaining the integrity of the TOC structure.
1 parent 2a0d598 commit 9f15699

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

gatsby/toc-filter.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,15 @@ export async function getFilesFromTocs(
6868
const tocNodes = tocQuery.data!.allMdx.nodes;
6969
const tocFilesMap = new Map<string, Set<string>>();
7070

71-
tocNodes.forEach((node: TocQueryData["allMdx"]["nodes"][0]) => {
71+
// TODO: Remove this filter once premium is public. Currently filtering out TOC-tidb-cloud-premium.md
72+
const filteredTocNodes = tocNodes.filter(
73+
(node: TocQueryData["allMdx"]["nodes"][0]) => {
74+
const relativePath = node.parent?.relativePath || "";
75+
return !relativePath.includes("TOC-tidb-cloud-premium.md");
76+
}
77+
);
78+
79+
filteredTocNodes.forEach((node: TocQueryData["allMdx"]["nodes"][0]) => {
7280
const { config } = generateConfig(node.slug);
7381
const toc = mdxAstToToc(node.mdxAST.children, config);
7482
const files = extractFilesFromToc(toc);

0 commit comments

Comments
 (0)