question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 issue

Issue 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

  1. 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:closed
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ageitgeycommented, Aug 29, 2018
0reactions
stale[bot]commented, Apr 25, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

files/wordpress.sql · dev · brownlr4 / AWSWordpress ... - GitLab
<p>Ghost comes with a beautiful default theme called Casper, which is designed to be a clean, readable publication layout and can be adapted ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found