gatsby-plugin-mdx | gatsby v1 mdx plugin , for gatsby v2 see https | Plugin library
kandi X-RAY | gatsby-plugin-mdx Summary
kandi X-RAY | gatsby-plugin-mdx Summary
gatsby v1 mdx plugin, for gatsby v2 see
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of gatsby-plugin-mdx
gatsby-plugin-mdx Key Features
gatsby-plugin-mdx Examples and Code Snippets
Community Discussions
Trending Discussions on gatsby-plugin-mdx
QUESTION
I was following the Gatsby tutorial, but I'm not seeing what they are seeing when it comes to generating slugs for mdx files in a subdirectory of src/pages
. For example when I have a file like src/pages/projects/devmarks/index.md
, according to the tutorial I would expect the slug to be devmarks
and thus be able to reach the page at localhost:8000/projects/devmarks
. However, the slug ends up being projects/devmarks
and I can only access the fully rendered page at localhost:8000/projects/projects/devmarks
. Interestingly, if I go to localhost:8000/projects/devmarks
, I do get the body of the mdx file rendered, but nothing else. I know I could probably fix this with a createPages function in a gatsby-node.js file or moving my {mdx.slug}.tsx file up one level, but I don't understand why my code isn't working like the tutorial.
gatsby-config.ts
...ANSWER
Answered 2022-Mar-30 at 05:12Your gatsby-source-filesystem
wasn't pointing to a valid path. Just use:
QUESTION
I'm trying to get a single line of anything from passed by props to render.
If nothing is passed or needed, then the MDX render outs. If props are passed and tried to be used, failure.
The only thing left on this site is getting MDX to actually render on build.
Running [Gatsby Dev] works, and the MDX file renders can use all props passed to it. Any attempt to [Gatsby Build] and it fails saying that it can't read undefined.
I've tried wrapping the render in a MDX provider, in a conditional statement that checks for the specific props first, but nothing works. Gatsby Build pretends like there are no props being passed at all.
POST TEMPLATE
...ANSWER
Answered 2022-Mar-22 at 10:25try adding this line:
QUESTION
I was trying to follow the documentation on including rehype plugins for gatsby-plugin-mdx. Specifically I was trying to use the rehype-slug
plugin. I installed the packaged with npm and set my gatsby.config.js
file to
ANSWER
Answered 2021-Sep-14 at 04:51Not sure if it will work but, instead of using require from ES modules have you tried something like:
QUESTION
I wonder what I'm doing wrong trying to create previous & next page link in my Gatsby website, below is the bug I'm trying to solve.
when I click the previous or next link instead of going to the requested page it creates the below route which is not suppose to do!
my code for Gatsby-node.js as below
...ANSWER
Answered 2022-Feb-08 at 10:04If I understood you correctly, the URL that is generated when clicking the previous and next buttons is "concatenating" the slug of the post to the current URL instead of replacing it, isn't it?
So, instead of creating a URL like localhost:8000/blog/next-article
is generating a localhost:8000/blog/current-article/next-article
.
This is because of the way you generate the links. You can spot the links route just by hovering the links to see that the URL of the previous/next article is being added at the end of the URL instead of replacing it.
This is because you are not adding the correct relativity to the links. Simply use:
QUESTION
I was trying to make two template for my projects details and blog post pages, but due to my lake of experience with Graphql & Gatsby I have managed to make it work for my projects, project details and blog posts but I have a bug which I couldn't find on my blog posts article template makes it not working??
here is my .md front matter
...ANSWER
Answered 2022-Feb-07 at 13:32There are a few things weird in your code that shouldn't be working despite your said it does.
In React, all components must be capitalized, otherwise, React will interpret them as HTML elements, and because normally a component name doesn't match an HTML tag, it will break because it won't exist.
In your case, both templates must be renamed to:
QUESTION
ANSWER
Answered 2022-Jan-26 at 17:48There are a few things to comment on here:
The render structure is weird. You should do a loop through your data, as you are doing to display the h1
but at the same time, you can take advantage of the loop to display the image of each employee.
In addition, you are using a Gatsby Image v2 GraphQL query structure (gatsby-image
) while the render component (GatsbyImage
) is from v3 (gatsby-plugin-image
). I'd recommend reading the migration guide.
To summarize, when you query for fluid
or fixed
images as you do while using the ...GatsbyImageSharpFluid
fragment you are querying a v2 structure and the render component should be Img
(from gatsby-image
), that is accepting a fixed
or a fluid
image. However, when you use a GatsbyImage
component, the passed prop should be a image
(no matter if it's fixed or fluid). So, you have conflicting plugins and structures. You should get rid of one of them and use the corresponding structure. To recap:
fixed
orfluid
GraphQL query: v2 structure, the render component isImg
GatsbyImage
component: v3 structure. I will base my answer on that assuming that you will migrate to v3 (v2 is deprecated).
The issue rises up because as I said,GatsbyImage
is expecting an image
prop while you are passing a loop at and a wrong query data at:
QUESTION
I have a componet which used in mdx files The problem is that the content in the componet is rendered as text but I want to render them as mdx. This is how mdx file look likes:
...ANSWER
Answered 2022-Jan-12 at 22:10
this part in the mdx file should be rendered as a link and a bold text right?
It doesn't unless you add an MDX Renderer or a markdown parser (like markdown-to-jsx
) to parse the markdown syntax into HTML.
In the end, what you are wrapping inside Notice
is a plain text that is rendered using the Notice
's component JSX structure, where the children
is rendered as-is ({children}
).
That said, you can try using the MDXRenderer
in your Notice
component like:
QUESTION
After migrating from Remark to MDX, my builds on Netlify are failing.
I get this error when trying to build:
...ANSWER
Answered 2022-Jan-08 at 07:21The problem is that you have Node 17.2.0. locally but in Netlify's environment, you are running a lower version (by default it's not set as 17.2.0). So the local environment is OK, Netlify environment is KO because of this mismatch of Node versions.
When Netlify deploys your site it installs and builds again your site so you should ensure that both environments work under the same conditions. Otherwise, both node_modules
will differ so your application will have different behavior or eventually won't even build because of dependency errors.
You can easily play with the Node version in multiple ways but I'd recommend using the .nvmrc
file. Just run the following command in the root of your project:
QUESTION
So I am trying to figure out how to render my images that are inline to my blog post. I do have a featured image up top that works but cannot figure out how to get inline images.
Images are stored in src/images/
ANSWER
Answered 2021-Dec-09 at 08:00The image under images/office2.jpg
is automatically rendered because it's under the body of the markdown. When you do:
QUESTION
I've just added gatsby-plugin-mdx to my gatsby plugins, but I keep getting this error when I start the project.
...ANSWER
Answered 2021-Dec-06 at 09:58It's difficult to spot without seeing the site live but I guess that the underlying issue is the gatsby-plugin-mdx
version (^3.3.0
). According to the changelog, the release note is linked to Gatsby v4.3, which is not compatible with your current Gatsby since yours is 3.14.6
and it requires a major upgrade (Gatsby 4).
That said, you have two options:
- Upgrade Gatsby and all the related dependencies at least until version 4
- Downgrade
gatsby-plugin-mdx
to2.14.0
which apparently is compatible to your current Gatsby version.
In both cases, you'll need to get rid of the package-lock.json
(or yarn.lock
) and reinstall the package to the needed version.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install gatsby-plugin-mdx
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page