Skip to content

How i can disable TOC for some pages? #343

Closed Answered by sheldygg
sheldygg asked this question in Q&A
Discussion options

You must be logged in to vote

Okay, now i know how do it.

In your source file you must create your custom frontmatter, and pass parameter for parsing.
Example of source file:

import {map} from '@/.map';
import {createMDXSource, defaultSchemas} from 'fumadocs-mdx';
import {loader} from 'fumadocs-core/source';
import {z} from 'zod';


const frontmatterSchema = defaultSchemas.frontmatter.extend({
    disableToc: z.boolean().optional(),
});

export const {getPage, getPages, pageTree} = loader({
    baseUrl: '/',
    rootDir: '',
    source: createMDXSource(map, {schema: {frontmatter: frontmatterSchema}}),
});

In your mdx file you must pass this parameter like this

---
title: ...
description: ...
disableToc: true
---

Final…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sheldygg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant