Advanced
By default,createApp() renders a full docs site with a top bar and side navigation. For cases where you want to bring your own shell — or embed the content area inside an existing layout — you can use DocsProvider and MDXContent directly.
DocsProvider
DocsProvider is the React context provider that makes your pages and site config available to all mdx-docs components. It must wrap anything that uses MDXContent.
jsximport { DocsProvider } from '@quietmind/mdx-docs'
| Prop | Type | Required | Description |
|---|---|---|---|
pages | Page[] | Yes | Array of page objects (same shape as createApp) |
site | object | Yes | Site config with name and description |
hideHomeFromNav | boolean | No | Hide the home route from navigation (default: false) |
footer | object | No | Footer config: { enabled, content } (enabled defaults to true) |
Footer
Every site renders a minimal "Built with MDX Docs" footer below the content. It is enabled by default. Setfooter: { enabled: false } to remove the footer entirely:
To render your own footer instead of the default attribution, pass ajsxcreateApp({pages,site,footer: { enabled: false },})
content node:
jsxcreateApp({pages,site,footer: { content: <p>Made with care by Your Team.</p> },})
MDXContent
MDXContent renders the routed MDX content area. It reads pages from the nearest DocsProvider and sets up React Router <Routes> for each page. It must be rendered inside both a DocsProvider and a React Router context.
jsximport { MDXContent } from '@quietmind/mdx-docs'
MDXContent takes no props.
Custom layout example
Use these two components together to render just the content area inside your own layout:
jsximport { BrowserRouter } from 'react-router-dom'import { DocsProvider, MDXContent } from '@quietmind/mdx-docs'import '@quietmind/mdx-docs/index.css'import pages from './config/pages'import site from './config/site'export default function App() {return (<DocsProvider pages={pages} site={site}><BrowserRouter><MyTopBar /><MySideNav /><main><MDXContent /></main></BrowserRouter></DocsProvider>)}
MDXContentdoes not include any MUIThemeProvider. If you are using MUI components in your own layout or MDX pages, wrap the tree in aThemeProviderbefore renderingMDXContent.
Sitemap generation
MDX Docs can generate asitemap.xml during production builds. Add an
absolute url to config/site.js to enable sitemap output and per-page
canonical metadata:
Whenjsexport const site = {name: "My Site",description: "My site description",url: "https://docs.example.com",};
url is set, yarn build writes a sitemap.xml that includes every
prerendered route:
Each page URL is built from the site URL and the page route. For example, a page registered atnonedist/sitemap.xml
/getting-started appears as:
Pages can opt out of the generated sitemap withxml<url><loc>https://docs.example.com/getting-started</loc></url>
excludeFromSitemap:
For sites deployed at the domain root, MDX Docs also writes ajsexport const pages = [{name: "Internal Notes",route: "/internal-notes",component: InternalNotesMDX,excludeFromSitemap: true,},];
robots.txt
pointing to the generated sitemap:
IfnoneUser-agent: *Allow: /Sitemap: https://docs.example.com/sitemap.xml
public/robots.txt already exists, MDX Docs leaves it unchanged. Sites
without site.url build normally, but sitemap, canonical URL, and og:url
generation are skipped.