-
Notifications
You must be signed in to change notification settings - Fork 40
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
page bundle images not handled #106
Comments
Sorry about that, it's pretty complicated to support image imports from the same folder since it has to go through webpack and I am not sure how it would work with next/image as well. The copy linked files approach could work, but might require additional transformation to the to the file path to ensure that all imports are relative to the public folder. |
Also, just a heads up that I will be making large changes to the example blog and migrating it to the new app dir structure very soon. Though I probably won't handle this image transformation automatically and would still recommend placing the images in the public folder. |
Can you document how to do this? (If do not consider the next/image extension) since all my blog use this kind of image. And many generator support it, vs code even added Ctrl + v auto save the Image to the same subdir. |
I hacked the plugin and now it works: due to after contentlayer (which uses mdx-bundler), the fullpath is not correct under pliny. my hack // path is something like `/path-to-project-root/_mdx_bundler_entry_point-3e814d53-72fb-474b-8853-f64f1521e36a.mdx`
// after contentlayer (which uses mdx-bundler)
// `file.data.rawDocumentData.sourceFilePath` begin with `blog/xxx`, does not include the `data` dir
const fullpath = resolve(
cwd,
dataDir,
file?.data?.rawDocumentData?.sourceFilePath ? dirname(file.data.rawDocumentData.sourceFilePath) : '',
platformNormalizedUrl,
); |
Describe the bug
my blog mdx files is from docusaurus, and it support page bundle images well.
recently I migrated to pliny. and found all images can not shown in the generated html
"page bundle images" means the image is under the same subdir as the
index.mdx
file.this way, I can keep the images and the blog markdown file in the same dir.
To Reproduce
the file struct is like:
Steps to reproduce the behavior:
enable nextjs trailingSlash, edit
next.config.js
add
trailingSlash: true,
have a blog under
/blog/demo/index.mdx
put a image under
/blog/demo/foo.png
and write
![foo](foo.png)
in/blog/demo/index.mdx
access
/blog/demo/
blog via web browser, the image can not show (/blog/demo/foo.png
not found)Expected behavior
support images put in page bundle
Screenshots
If applicable, add screenshots to help explain your problem.
System Info (if dev / build issue):
Browser Info (if display / formatting issue):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: