Is there a way to configure pages to display custom components that have access to frontmatter? #1508
Answered
by
fuma-nama
williamlmao
asked this question in
Q&A
-
For example, I want each of my MDX pages to display the title and description that I place in the front matter. It would be repetitive for me to import a Title and Description component in every MDX file, so I would like to be able to configure this at some page layout level. |
Beta Was this translation helpful? Give feedback.
Answered by
fuma-nama
Feb 14, 2023
Replies: 1 comment 1 reply
-
Yes, if you are using import { useConfig } from "nextra-theme-docs";
//inside a component
const frontMatter = useConfig().frontMatter To inject components into the body, you may override the |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
williamlmao
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, if you are using
nextra-docs-theme
, here's how you can get thefrontMatter
of the pageTo inject components into the body, you may override the
main
componentCheck here for further information