William and I are the original developers of an Open Source integration between Ghost and OpenAI. Our goal is to enhance Ghost with AI integration as much as possible. We are pleased to present our first solution, which addresses the long-standing issue of finding similar posts in Ghost without requiring any deep customization of Ghost to support Elastic or similar technologies.
We would greatly appreciate your feedback and adoption of this solution. Depending on the response, we plan to release additional AI-powered solutions, including a custom chatbot trained from your own content and an OpenAI-powered search feature.
Thank you for your consideration.
Introducing GhostAI Related Posts
GhostAI Related Posts is a project that utilizes OpenAI Embedding API to generate related blog post tags for a given Ghost Blogging site. The project provides the functionality to display “Related Posts” at the bottom of each blog post. Currently, this feature is not available in Ghost.
Check out a sample blog post with related topics at the bottom: Experiences with the Standard Suspension on BMW iX50: What type of suspension should you pick?
The project comprises of two scripts that can be executed either on a local machine or directly on the server. Unless the site has tens of thousands of blog posts, running the scripts on a local machine should suffice.
The first script iterates through all public blog posts on the server and extracts the text content, which is then sent to the OpenAI (Ada model) to generate a set of vectors. These vectors are then stored in a text file (find them in ./output/). The script also supports incremental generation, which means that it only generates vectors for blog posts that have not yet been processed.
The second script iterates through all the vectors in the directory and ranks their similarity by giving a score. For each blog post, a few other blog posts with high similarity ranking will be grouped together. Ghost internal tagging feature is used for the grouping mechanism, and each blog post ID becomes the internal tag name.
To display the related blog posts at the bottom of another blog post, the post.hbs template needs to be edited by inserting a simple tag filter. This design works with both self-hosted Ghost sites and Ghost Pro sites (hosted by the Ghost team) and does not require any additional configuration, database changes, or other adjustments.
Users can contribute to the GhostAI Related Posts project by submitting pull requests on Github. We welcome any improvements to the project, including bug fixes, new features, and enhancements.
Need help setting up?
For the first few sites, we would be happy to assist you in setting up and running the integration. If you are interested, please feel free to direct message me here, and I would be glad to provide further assistance from there.