Hacking the Ghost Core


#1

I need post images to display using an <img ix-src="..." /> tag rather than an <img src="..." /> tag.

I have installed a ghost installation on my machine using the steps outlined at https://docs.ghost.org/docs/working-with-ghost

It appears to me that the changes I need can be made by modifying the image.js file located at:
Ghost—>core—>server—>lib—>mobiledoc—>cards—>image.js

I changed this line of code from this:

let img = dom.createElement('img');
img.setAttribute('src', payload.src);

To:

let img = dom.createElement('img');
img.setAttribute('ix-src', payload.src);

However, the changes don’t appear to have any effect. I’m unsure if I am editing the correct file, or if there is a step I need to do to get the changes to take effect besides just running grunt dev


#2

Are you looking at posts that are already created? If so they won’t be run through the mobiledoc conversion. I’ve tried your change locally and newer posts contain the correct attribute. If you need older posts to be updated, then you’ll have to create a migration similar to the one here: https://github.com/TryGhost/Ghost/blob/master/core/server/data/migrations/versions/2.0/2-update-posts.js


#3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.