CLI tool for managing Ghost content in Typesense
npm install @magicpages/ghost-typesense-cliCommand-line tool for managing Ghost content in Typesense.
``bash`
npm install -g @magicpages/ghost-typesense-cli
1. Create ghost-typesense.config.json:
Minimal configuration:
`json`
{
"ghost": {
"url": "https://your-ghost-blog.com",
"key": "your-content-api-key",
"version": "v5.0"
},
"typesense": {
"nodes": [{
"host": "your-typesense-host",
"port": 443,
"protocol": "https"
}],
"apiKey": "your-admin-api-key"
},
"collection": {
"name": "ghost"
}
}
The tool comes with default field configurations optimized for Ghost CMS. These include:
- Required fields: id, title, url, slug, html, plaintext, excerpt, published_at, updated_atfeature_image
- Optional fields: , tags, authors
The plaintext field is automatically generated from HTML content if not provided by Ghost, ensuring better search quality.
You can override or add additional fields by specifying them in the config:
`json`
{
"collection": {
"name": "ghost",
"fields": [
{ "name": "title", "type": "string", "index": true, "sort": true },
{ "name": "plaintext", "type": "string", "index": true },
{ "name": "custom_field", "type": "string", "optional": true }
]
}
}
The tool will ensure all required fields are present with correct types while keeping your custom fields.
2. Available commands:
`bashInitialize collection
ghost-typesense init --config ghost-typesense.config.json
Configuration
| Option | Description |
|--------|-------------|
|
ghost.url | Your Ghost blog URL |
| ghost.key | Content API key |
| ghost.version | Ghost API version |
| typesense.nodes | Array of Typesense nodes |
| typesense.apiKey | Admin API key |
| collection.name` | Collection name |MIT © MagicPages