Skip to content

Commit

Permalink
Ability to render TOC in type page (#4082)
Browse files Browse the repository at this point in the history
* fix: simplify TOC rendering condition in ClientWrapper component

* fix: remove unnecessary condition for breadcrumb rendering in ClientWrapper component

* fix: update theme settings to disable breadcrumb and TOC for specific pages

* allow change `_meta` file `theme.toc` property with `type: 'page'`

---------

Co-authored-by: Dimitri POSTOLOV <[email protected]>
  • Loading branch information
hichemfantar and dimaMachina authored Jan 28, 2025
1 parent 5e86a14 commit 2ba45de
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/twelve-hotels-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nextra-theme-docs": patch
---

allow change `_meta` file `theme.toc` property with `type: 'page'`
3 changes: 2 additions & 1 deletion docs/app/_meta.global.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ export default {
blog: {
type: 'page',
theme: {
typesetting: 'article'
typesetting: 'article',
toc: false
}
},
about: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const ClientWrapper: MDXWrapper = ({
className="nextra-toc x:order-last x:max-xl:hidden x:w-64 x:shrink-0 x:print:hidden"
aria-label="table of contents"
>
{themeContext.toc && activeType !== 'page' && (
{themeContext.toc && (
<TOC
toc={themeConfig.toc.float ? toc : []}
filePath={metadata.filePath}
Expand Down

0 comments on commit 2ba45de

Please sign in to comment.