Closed rolule closed 2 years ago
Thank you for suggesting this enhancement @rolule. To what I said in #270, the media retrieval should be based on the content types that have the pageBundle
property enabled.
As I was trying to reproduce it, I noticed the logic of creating relative paths was already in place when inserting images into the article's content. Just to understand it a bit better:
Logic has changed a bit to make sure that sub-folders are also supported in the scenario. Feel free to test out the latest beta version.
Hello @estruyf, thank you for the fast reply. I am using MacOS 12.2 (21D49). I was referring to adding the image into the front matter of the article. Adding the images to the content by clicking the WYSIWYG editor does not work in MDX files for me (might create a separate issue for this).
I tried the latest beta, but I did not notice any changes.
Changes that were added, were to the relative paths in the content, not yet in the front matter.
I checked out the new Beta and it worked, thank you ! The path in the front matter is now ./image1.jpg
. Maybe we can even leave out the./
? Also, relatively resolving the sibling leaf-nodes did not work for me yet (e.g: ../leaf-bundle-2/image2.jpg)
Wasn't completed yet, but thanks for verifying 🙏
With this change, the relative paths work for the current bundle and sub-leafs.
Awesome ! Works like a charm. Thank you :)
Is your feature request related to a problem? Please describe. I am using Front Matter with the Gatsby framework and MDX files. My folder structure looks basically identical to the "Page and leaf bundles" example (except I use MDX files). When I add an image located in the same folder as the the index.mdx file, Front Matter always adds the absolute path to the image (/content/posts/leaf-bundle/image1.jpg) instead of the much shorter relative path (./image1.jpg). However, Gatsby MDX does not seem to support absolute image paths out of the box, so it fails creating the post when it encounters the image url.
Describe the solution you'd like I would love a setting that forces relative paths when adding images through Front Matter. In the example above, the path would then be only the image's file name and not the full absolute path. It should also apply to sibling leaf-nodes (../leaf-bundle-2/image2.jpg). This would make resolving (image) files in the same directory much easier in Gatsby, but I am sure this also applies to other frameworks as well.
Describe alternatives you've considered The alternative would be to find a Gatsby workaround for this, which I could not find yet unfortunately.