To export your Ghost blog content for use with Lunr.js, you'll need to:
- Fetch the content from Ghost (using the Ghost Content API).
- Format the data to be compatible with Lunr.js.
- Index and use the content with Lunr.js on your static site.
Steps to Export Ghost Blog Content for Lunr.js
- Fetch Ghost Content via API Ghost offers a Content API that allows you to retrieve all your blog posts, pages, and other data. You can make an API request to get this data and then use it to create a search index.
First, get your Content API key:
Go to Ghost Admin → Settings → Integrations → Add custom integration and copy your Content API Key. Now, you can fetch posts with a simple API call. Here’s an example using Python to fetch the blog posts