The Use Of Custom Code In Ghost 2


#1

Hi all. I’ve just started using Ghost 2.2.2. Installed ok and currently looking around. I wanted to add custom code and not sure if Ghost is based off MVC. I was looking for a controller of some sort where I could add custom code, put the result into a variable and output that variable in views. Is this possible?

I want to, say, @variable = some-logic


#2

Hey,

Are you looking to do this on the front facing portion of your blog, or are you trying to do this for the backend admin section? Do you have an example of what you want to do?

David B


#3

Hi David. It’s for the front-end. Basically, I’ll be getting data from an external API then display the results in view (frontend). I can’t find such tutorial


#4

Here is all they api docs if that helps - http://api.ghost.org/. You should be able to pull any data and manipulate it in whatever way you want. I can try and help further if you get more specific, but their docs should cover everything you need.


#5

Thanks. I’ll have a read and if not successful, I’ll be more specific with code examples.


#6

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