October 31, 2019 by Tomek
Ghost is a very popular open-source publishing platform, described by many as a modern alternative to WordPress. Their premise is making publishing as easy as possible and they do deliver!
A week ago big news hit the Internet that the new version of Ghost is available and I think that the release timing wasn’t a coincidence … Happy Halloween ;)
As mentioned by its developers, Ghost 3.0 is all about enabling new business models for publishers.
If that’s not enough and you are still hesitating if you should give Ghost a try it is also worth mentioning that:
One of my favorite things about Ghost is that it works great with Gatsby & Gatsby equals GraphQL. GraphQL is a query language for APIs where when you ask for data you get exactly what you need - nothing more, nothing less. This how it looks compared to REST.
Fetching data from the Ghost API for a Gatsby site is very simple, especially when using GraphQL. Let’s take a look at some basic operations that can be done to retrieve data from the Ghost API with GraphQL. Take a look at these common examples of operation you probably need to perform when using GraphQL to query the Ghost API for your company page, news site or blog. All examples come from Ghost docs.
In this example, we take a limited amount of posts per page & use ‘skip’ to paginate through pages containing those posts:
Filtering posts by tag is a widely used case:
The Ghost settings node differs from other nodes (it’s a single object). To query it you need to:
Getting all tags from a Ghost site is simple. You could them to form a tag cloud or a keywords list:
The GraphQL Editor is a supportive tool for both advanced GraphQL users as well as those taking their first steps with GraphQL APIs. Our all-in-one development environment for GraphQL will help you build, manage & deploy your GraphQL API much faster thanks to dozens of built-in micro features. Its graphical interface will also fix communication within your product team. Visualization is the key!