Ghost 2.0's zip file import does not update relative image paths as indicated in the docs when using mobiledoc cards
See original GitHub issueIssue Summary
I wrote a Medium-to-Ghost utility that converts all the user’s Medium posts into Ghost 2.0-compatible mobiledocs and creates an import zip file for Ghost containing a .json and the associated images. In general it works amazingly well and the result in Ghost is nearly identical to what the user had on Medium. Nice job with 2.0!
To include images in the Ghost mobiledoc posts, I’m inserting a mobiledoc card
of type image
with the src
set to the local path of the corresponding image in the zip file.
According to the docs:
When uploading a zip which includes both images and a JSON or markdown file, the relative path to the images from the JSON should match any relative path used inside the JSON/markdown data. Ghost will then attempt to update the image paths in the content of the JSON/markdown such that they will continue to work after importing.
However, this is not true when importing mobiledoc image cards. Ghost does not seem to update the image paths as it says.
Example: If an imported post’s mobiledoc
has an image card that refers to src: "/medium_images/my_image.jpg"
, the imported post will have a broken image pointing to http://mydomain.com/medium_images/my_image.jpg
The only way to generate an imported post with working images is to create the mobiledoc image card with the src
attribute pointing to the full final path of the image after importing, i.e. /content/images/medium_images/my_image.jpg
on my development installation.
To Reproduce
- Import this example zip file into a Ghost 2.0 instance: broken_import.zip
Expected result: Post will have working image Actual result: Post will have broken image link
Technical details:
- Ghost Version: 2.0.3
- Node Version: 8.11.4
- Browser/OS: Chrome 68 on macOS
- Database: sqlite development local install
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (2 by maintainers)
Top GitHub Comments
@pascalandy Sure, I just posted it here: https://github.com/ageitgey/medium_to_ghost
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.