-
Notifications
You must be signed in to change notification settings - Fork 195
How to import contents and data into my mdx documents #273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for opening this issue. Can you please provide a reproduction repo with instructions how to reproduce the problem you're experiencing? Thank you! |
Hey @schickling Thanks for the reply. Project repoThe repo can be found here - https://github.com/flowershow/flowershow It can be run by doing the following: cd templates/default
npm install
npm run dev Within Also note that the content directory is symlinked to Related to our issueI have setup test pages and test components that include a working component and another one that reproduces the error. PagesThere are two test pages which can be found at:
ComponentsThe components can be found at
Thanks again for looking into this and appreciate your help! |
Thanks for the further information @khalilcodes. I've taken a brief look but couldn't yet identify the problem. I suspect this to be rather a problem in your project than a problem with Contentlayer. As a first step I'd suggest using the Also feel free to join the Contentlayer discord where some community members might be able to help you. |
Thank you so much for your help, @schickling 🌻! We've changed |
Is there a way to directly import components in the mdx files ? Could not find anything related in the docs but looking at issue #266 it seems like import statements are supported. Unfortunately, I haven't been able to get this working. Please see below for more info about the error and what works.
The Error
when importing a component in a markdown file like
index.mdx
, it throws an error -unexpected "<"
For example the import statement as below:
gives the following error:
But this works
If the return statement of the component is a string, then it renders without any errors.
for example if the following is the component:
and we import it in md like below:
The text was updated successfully, but these errors were encountered: