Skip to content

如何建立並使用mdx頁面? #406

Closed Answered by fuma-nama
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

Sidebar is a part of layout.

To remove the sidebar from layout, use Non-docs Layout.

To create a separate page with MDX (similar to https://yeecord.com/privacy), you can create a page.mdx under a non-docs layout and add mdx to page extensions:

const nextConfig = {
  pageExtensions: ["ts", "tsx", "mdx"],
};

Finally in the page.mdx, add the following to apply typography styles.

export default ({ children }) => (
  <main className="container py-12">
    <div className="prose">{children}</div>
  </main>
);

Deep Dive

Under docs layout, you can't opt-out of sidebar from a specific page (e.g. MDX file). This is by design, App Router doesn't allow changing the layout from page.
If we move the doc…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ghost
Comment options

Answer selected by fuma-nama
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