Live-export img link error

Bug report

Hi Mr. Matsuyama,

I followed the Astro live-import tutorial, and everything worked fine until I imported the image using the inkdrop://file:* path. After that, the blog started throwing errors.

Is there any way to retrieve the actual file path of the image I imported? This would allow me to manually reference it, but ideally, I would prefer to rewrite the scripts to automate the process.

Environment

  • Platform: macOs
  • Platform version: 13.7.1
  • App Version: 5.10.0

How to reproduce

Create a note and post image inside and u would get a link
image

run the scripts pnpm run live-import
it did add new md file in posts, but the image link would cause the error.

terminal

You can specify file names for image attachments with pathForFile via LiveExporter.
Check out my “uses” blog as an example here:

If you don’t understand what’s wrong, can you share your script?

Thx I got it, i should add /posts/ manually, so it exports to the right path.

import fs from 'node:fs'
...
if (!fs.existsSync(publicPath)) {
  fs.mkdirSync(publicPath, { recursive: true })
}

I think this code(or an alternative) should be added into the inkdrop template to prevent this issue.

If I misunderstood the document, just forget about it. :joy:

:heart_eyes: Time to bring out my little magic card and support Inkdrop!

1 Like

fixed it. Thanks!