Postlet

Embeddings-Based Related Posts Setup

Fri May 08 2026 · Postlet Team

Postlet can compute related posts using semantic similarity instead of keyword overlap.

1. Enable the embeddings strategy

In config.json, set relatedPosts.strategy to embeddings and provide model settings:

"relatedPosts": {
  "enabled": true,
  "strategy": "embeddings",
  "topK": 3,
  "minScore": 0.05,
  "writeBackToFrontmatter": false,
  "strategies": {
    "embeddings": {
      "baseUrl": "https://api.openai.com/v1",
      "apiKeyEnv": "OPENAI_API_KEY",
      "model": "text-embedding-3-small",
      "cacheFile": ".embeddings-cache.json"
    }
  }
}

2. Provide the API key

Set OPENAI_API_KEY in your shell before running builds.

3. Build and verify

Run:

npm run build

Then inspect generated pages to confirm each post now shows semantically related content.

Notes

  • Use writeBackToFrontmatter: false if you want clean source files.
  • Remove .embeddings-cache.json to force full re-embedding.
YOU CAN PLACE ANY CUSTOM HTML HERE THAT WILL GO BEFORE CLOSING BODY TAG ... THIS IS DRIVEN BY analytics.js plugin