-
|
TODO What kind of customization should I do to make this possible? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
This is confusing me:
TOC and sidebar are 2 separate things. You can find a way to display images in the left (sidebar) with You can find a way to display an image in the right (TOC) by swizzling the TOC component and using frontmatter here. For example swizzle import React from 'react';
import {ThemeClassNames} from '@docusaurus/theme-common';
import {useDoc} from '@docusaurus/theme-common/internal';
import TOC from '@theme/TOC';
export default function DocItemTOCDesktop(): JSX.Element {
const {toc, frontMatter} = useDoc();
return (
<>
<img src={frontMatter.my_custom_image}/>
<TOC
toc={toc}
minHeadingLevel={frontMatter.toc_min_heading_level}
maxHeadingLevel={frontMatter.toc_max_heading_level}
className={ThemeClassNames.docs.docTocDesktop}
/>
</>
);
}Remember that the doc TOC renders differently on desktop and mobile: make sure you handle both cases independently. I also assume you only want to enhance the TOC of docs, not blog posts. It would be easier to help you if you provided a mockup of what you want to achieve |
Beta Was this translation helpful? Give feedback.
-
|
I solved with swizzle only DocItem and update TOC column in row 104. |
Beta Was this translation helpful? Give feedback.
I solved with swizzle only DocItem
npm run swizzle @docusaurus/theme-classic DocItem -- --eject
and update TOC column in row 104.