Programming help (Solved)

I want to write a sidebar widget to parse a content stream and present the data in the sidebar. (Most-read posts in past 14 days from Clicky, the analytics tool I use)

I don’t mind making the attempt, but I’d like to see a code example of parsing in a Ghost file. Here’s the pertinent API line from Clicky documentation:

“The API accepts requests via standard HTTP GET, and can respond with XML, JSON, serialized PHP, and CSV.”

I realize this is probably more work than someone wants to do, so if you can point me to a good resource on doing this, I’m glad to go read up. If I get something working, I’ll be glad to share. Thanks!

There’s no server-side programming available in Ghost so there’s no Ghost-specific example to show.

You have options for dynamic content though:

  1. do everything in client-side JavaScript (if you’re using authenticated APIs or need to cache responses that may not be an option)
  2. have a separate micro-service/serverless function/etc that does the API fetching, parsing, and html generation in your language of choice and then inject that into your sidebar using javascript or via an iframe

Good point about the server-side programming. I was thinking about a client-side widget, but didn’t make that clear.

I think I need to learn more about handlebar files and what they can do, as well as try to write this in JS on my own. Thanks for the response!